v0.3.5: Warrior's seal can no longer 'steal' upgrades

This commit is contained in:
Evan Debenham 2016-04-25 21:19:51 -04:00
parent f4899c06fa
commit c52ca8bf37
2 changed files with 26 additions and 20 deletions

View File

@ -64,7 +64,7 @@ public class Armor extends EquipableItem {
private int hitsToKnow = HITS_TO_KNOW; private int hitsToKnow = HITS_TO_KNOW;
public Glyph glyph; public Glyph glyph;
public boolean seal; private BrokenSeal seal;
public Armor( int tier ) { public Armor( int tier ) {
@ -92,21 +92,25 @@ public class Armor extends EquipableItem {
hitsToKnow = HITS_TO_KNOW; hitsToKnow = HITS_TO_KNOW;
} }
inscribe((Glyph) bundle.get(GLYPH)); inscribe((Glyph) bundle.get(GLYPH));
seal = bundle.getBoolean(SEAL); //TODO holdover from beta releases, remove in 0.4.0
if (seal) unique = true; if (bundle.getBoolean(SEAL)){
seal = new BrokenSeal();
if (level() > 0) seal.level(1);
} else
seal = (BrokenSeal)bundle.get(SEAL);
} }
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
//armor can be kept in bones between runs, the seal cannot. //armor can be kept in bones between runs, the seal cannot.
seal = false; seal = null;
} }
@Override @Override
public ArrayList<String> actions(Hero hero) { public ArrayList<String> actions(Hero hero) {
ArrayList<String> actions = super.actions(hero); ArrayList<String> actions = super.actions(hero);
if (seal) actions.add(AC_DETACH); if (seal != null) actions.add(AC_DETACH);
return actions; return actions;
} }
@ -115,14 +119,11 @@ public class Armor extends EquipableItem {
super.execute(hero, action); super.execute(hero, action);
if (action.equals(AC_DETACH) && seal){ if (action.equals(AC_DETACH) && seal != null){
seal = false;
BrokenSeal.WarriorShield sealBuff = hero.buff(BrokenSeal.WarriorShield.class); BrokenSeal.WarriorShield sealBuff = hero.buff(BrokenSeal.WarriorShield.class);
if (sealBuff != null) sealBuff.setArmor(null); if (sealBuff != null) sealBuff.setArmor(null);
BrokenSeal seal = new BrokenSeal(); if (seal.level() > 0){
if (level() > 0){
seal.upgrade();
degrade(); degrade();
} }
GLog.i( Messages.get(Armor.class, "detach_seal") ); GLog.i( Messages.get(Armor.class, "detach_seal") );
@ -130,6 +131,7 @@ public class Armor extends EquipableItem {
if (!seal.collect()){ if (!seal.collect()){
Dungeon.level.drop(seal, hero.pos); Dungeon.level.drop(seal, hero.pos);
} }
seal = null;
} }
} }
@ -164,11 +166,11 @@ public class Armor extends EquipableItem {
@Override @Override
public void activate(Char ch) { public void activate(Char ch) {
if (seal) Buff.affect(ch, BrokenSeal.WarriorShield.class).setArmor(this); if (seal != null) Buff.affect(ch, BrokenSeal.WarriorShield.class).setArmor(this);
} }
public void affixSeal(BrokenSeal seal){ public void affixSeal(BrokenSeal seal){
this.seal = true; this.seal = seal;
if (seal.level() > 0){ if (seal.level() > 0){
//doesn't override existing glyphs, but doesn't create one either //doesn't override existing glyphs, but doesn't create one either
upgrade(glyph != null); upgrade(glyph != null);
@ -178,6 +180,10 @@ public class Armor extends EquipableItem {
} }
} }
public BrokenSeal checkSeal(){
return seal;
}
@Override @Override
protected float time2equip( Hero hero ) { protected float time2equip( Hero hero ) {
return 2 / hero.speed(); return 2 / hero.speed();
@ -229,6 +235,9 @@ public class Armor extends EquipableItem {
} }
} }
if (seal != null && seal.level() == 0)
seal.upgrade();
STR--; STR--;
return super.upgrade(); return super.upgrade();
@ -294,7 +303,7 @@ public class Armor extends EquipableItem {
info += "\n\n" + Messages.get(Armor.class, "cursed_worn"); info += "\n\n" + Messages.get(Armor.class, "cursed_worn");
} else if (cursedKnown && cursed) { } else if (cursedKnown && cursed) {
info += "\n\n" + Messages.get(Armor.class, "cursed"); info += "\n\n" + Messages.get(Armor.class, "cursed");
} else if (seal) { } else if (seal != null) {
info += "\n\n" + Messages.get(Armor.class, "seal_attached"); info += "\n\n" + Messages.get(Armor.class, "seal_attached");
} }
@ -303,7 +312,7 @@ public class Armor extends EquipableItem {
@Override @Override
public Emitter emitter() { public Emitter emitter() {
if (!seal) return super.emitter(); if (seal == null) return super.emitter();
Emitter emitter = new Emitter(); Emitter emitter = new Emitter();
emitter.pos(10f, 6f); emitter.pos(10f, 6f);
emitter.fillTarget = false; emitter.fillTarget = false;
@ -346,7 +355,6 @@ public class Armor extends EquipableItem {
@Override @Override
public int price() { public int price() {
if (seal) return 0;
int price = 10 * (1 << (tier - 1)); int price = 10 * (1 << (tier - 1));
if (glyph != null) { if (glyph != null) {
price *= 1.5; price *= 1.5;

View File

@ -20,8 +20,6 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.armor; package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
@ -56,9 +54,9 @@ abstract public class ClassArmor extends Armor {
switch (owner.heroClass) { switch (owner.heroClass) {
case WARRIOR: case WARRIOR:
classArmor = new WarriorArmor(); classArmor = new WarriorArmor();
classArmor.seal = armor.seal; BrokenSeal seal = armor.checkSeal();
if (armor.seal && armor.isEquipped(owner)){ if (seal != null) {
Buff.affect(Dungeon.hero, BrokenSeal.WarriorShield.class).setArmor(classArmor); classArmor.affixSeal(seal);
} }
break; break;
case ROGUE: case ROGUE: