v0.3.5: beginnings of warrior rework (needs lots of polish)

This commit is contained in:
Evan Debenham 2016-03-07 13:22:09 -05:00
parent bc4d7f19bb
commit 2d7a13b14c
7 changed files with 82 additions and 123 deletions

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
@ -257,13 +258,14 @@ public abstract class Char extends Actor {
} }
} }
if (SHLD >= dmg){ //FIXME: when I add proper damage properties, should add an IGNORES_SHIELDS property to use here.
if (src instanceof Hunger || SHLD == 0){
HP -= dmg;
} else if (SHLD >= dmg){
SHLD -= dmg; SHLD -= dmg;
} else if (SHLD > 0) { } else if (SHLD > 0) {
HP -= (dmg - SHLD); HP -= (dmg - SHLD);
SHLD = 0; SHLD = 0;
} else {
HP -= dmg;
} }
if (dmg > 0 || src instanceof Char) { if (dmg > 0 || src instanceof Char) {

View File

@ -25,24 +25,20 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.PotionBandolier;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.ScrollHolder;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.SeedPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.ShortSword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.ShortSword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
public enum HeroClass { public enum HeroClass {
@ -108,15 +104,15 @@ public enum HeroClass {
} }
private static void initWarrior( Hero hero ) { private static void initWarrior( Hero hero ) {
hero.STR = hero.STR + 1;
(hero.belongings.weapon = new ShortSword()).identify(); (hero.belongings.weapon = new ShortSword()).identify();
Dart darts = new Dart( 8 ); Dart darts = new Dart( 8 );
darts.identify().collect(); darts.identify().collect();
hero.belongings.armor.activate(hero);
Dungeon.quickslot.setSlot(0, darts); Dungeon.quickslot.setSlot(0, darts);
new PotionOfStrength().setKnown(); new PotionOfHealing().setKnown();
} }
private static void initMage( Hero hero ) { private static void initMage( Hero hero ) {

View File

@ -0,0 +1,37 @@
package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
//TODO: add actual item properties here
public class BrokenSigil {
public static class SigilShield extends Buff {
private Armor armor;
private float partialShield;
@Override
public boolean act() {
if (armor == null) detach();
else if (armor.isEquipped((Hero)target)) {
//1 + half of your DR, rounded up.
int maxShield = (int)(armor.DR()/2f + 1.5f);
if (target.SHLD < maxShield){
partialShield += (maxShield - target.SHLD)/50f;
}
}
while (partialShield >= 1){
target.SHLD++;
partialShield--;
}
spend(TICK);
return true;
}
public void setArmor(Armor arm){
armor = arm;
}
}
}

View File

@ -23,7 +23,11 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSigil;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Affection;
@ -40,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.particles.Emitter;
import com.watabou.utils.Bundlable; import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -57,6 +62,7 @@ public class Armor extends EquipableItem {
private int hitsToKnow = HITS_TO_KNOW; private int hitsToKnow = HITS_TO_KNOW;
public Glyph glyph; public Glyph glyph;
private boolean sigil;
public Armor( int tier ) { public Armor( int tier ) {
@ -99,6 +105,7 @@ public class Armor extends EquipableItem {
} }
((HeroSprite)hero.sprite).updateArmor(); ((HeroSprite)hero.sprite).updateArmor();
activate(hero);
hero.spendAndNext( 2 * time2equip( hero ) ); hero.spendAndNext( 2 * time2equip( hero ) );
return true; return true;
@ -111,6 +118,12 @@ public class Armor extends EquipableItem {
} }
} }
@Override
public void activate(Char ch) {
if (Dungeon.hero.heroClass == HeroClass.WARRIOR)
Buff.affect(ch, BrokenSigil.SigilShield.class).setArmor(this);
}
@Override @Override
protected float time2equip( Hero hero ) { protected float time2equip( Hero hero ) {
return hero.speed(); return hero.speed();
@ -123,6 +136,9 @@ public class Armor extends EquipableItem {
hero.belongings.armor = null; hero.belongings.armor = null;
((HeroSprite)hero.sprite).updateArmor(); ((HeroSprite)hero.sprite).updateArmor();
BrokenSigil.SigilShield sigil = hero.buff(BrokenSigil.SigilShield.class);
if (sigil != null) sigil.setArmor(null);
return true; return true;
} else { } else {
@ -229,6 +245,17 @@ public class Armor extends EquipableItem {
return info; return info;
} }
@Override
public Emitter emitter() {
//if (!sigil) return super.emitter();
if (Dungeon.hero.heroClass != HeroClass.WARRIOR) return super.emitter();
Emitter emitter = new Emitter();
emitter.pos(10f, 6f);
emitter.fillTarget = false;
emitter.pour(Speck.factory( Speck.LIGHT ), 1f);
return emitter;
}
@Override @Override
public Item random() { public Item random() {
if (Random.Float() < 0.4) { if (Random.Float() < 0.4) {

View File

@ -113,14 +113,8 @@ abstract public class Weapon extends KindOfWeapon {
float ACU = this.ACU; float ACU = this.ACU;
if (this instanceof MissileWeapon) { if (this instanceof MissileWeapon) {
switch (hero.heroClass) { if (hero.heroClass == HeroClass.HUNTRESS) {
case WARRIOR:
encumbrance += 3;
break;
case HUNTRESS:
encumbrance -= 2; encumbrance -= 2;
break;
default:
} }
int bonus = 0; int bonus = 0;
for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) {

View File

@ -20,113 +20,16 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class ShortSword extends MeleeWeapon { public class ShortSword extends MeleeWeapon {
public static final String AC_REFORGE = "REFORGE";
private static final String TXT_SELECT_WEAPON = "Select a weapon to upgrade";
private static final String TXT_REFORGED =
"you reforged the short sword to upgrade your %s";
private static final String TXT_NOT_BOOMERANG =
"you can't upgrade a boomerang this way";
private static final float TIME_TO_REFORGE = 2f;
private boolean equipped;
{ {
image = ItemSpriteSheet.SHORT_SWORD; image = ItemSpriteSheet.SHORT_SWORD;
unique = true;
bones = false;
} }
public ShortSword() { public ShortSword() {
super( 1, 1f, 1f ); super( 1, 1f, 1f );
STR = 11;
} }
@Override
protected int maxBase() {
return 12;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (level() > 0) {
actions.add( AC_REFORGE );
}
return actions;
}
@Override
public void execute( Hero hero, String action ) {
if (action == AC_REFORGE) {
if (hero.belongings.weapon == this) {
equipped = true;
hero.belongings.weapon = null;
} else {
equipped = false;
detach( hero.belongings.backpack );
}
curUser = hero;
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, TXT_SELECT_WEAPON );
} else {
super.execute( hero, action );
}
}
private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
if (item != null && !(item instanceof Boomerang)) {
Sample.INSTANCE.play( Assets.SND_EVOKE );
ScrollOfUpgrade.upgrade( curUser );
evoke( curUser );
GLog.w( TXT_REFORGED, item.name() );
((MeleeWeapon)item).safeUpgrade();
curUser.spendAndNext( TIME_TO_REFORGE );
Badges.validateItemLevelAquired( item );
} else {
if (item instanceof Boomerang) {
GLog.w( TXT_NOT_BOOMERANG );
}
if (equipped) {
curUser.belongings.weapon = ShortSword.this;
} else {
collect( curUser.belongings.backpack );
}
}
}
};
} }

View File

@ -200,11 +200,11 @@ actors.hero.hero.pain_resist=The pain helps you resist the urge to sleep.
actors.hero.hero.revive=The ankh explodes with life-giving energy! actors.hero.hero.revive=The ankh explodes with life-giving energy!
actors.hero.heroclass.warrior=warrior actors.hero.heroclass.warrior=warrior
actors.hero.heroclass.warrior_perk1=The Warrior starts with 11 points of Strength. actors.hero.heroclass.warrior_perk1=The Warrior starts with a broken sigil which he can affix to armor.
actors.hero.heroclass.warrior_perk2=The Warrior starts with a unique short sword. This sword can later be "reforged" to upgrade another melee weapon. actors.hero.heroclass.warrior_perk2=The Warrior will slowly generate a shield while he is wearing armor with the sigil affixed.
actors.hero.heroclass.warrior_perk3=The Warrior is less proficient with missile weapons. actors.hero.heroclass.warrior_perk3=The sigil can be moved between armor, carrying a single upgrade with it.
actors.hero.heroclass.warrior_perk4=Any piece of food restores some health when eaten. actors.hero.heroclass.warrior_perk4=Any piece of food restores some health when eaten.
actors.hero.heroclass.warrior_perk5=Potions of Strength are identified from the beginning. actors.hero.heroclass.warrior_perk5=Potions of Healing are identified from the beginning.
actors.hero.heroclass.mage=mage actors.hero.heroclass.mage=mage
actors.hero.heroclass.mage_perk1=The Mage starts with a unique Staff, which can be imbued with the properties of a wand. actors.hero.heroclass.mage_perk1=The Mage starts with a unique Staff, which can be imbued with the properties of a wand.