From c52ca8bf373fc8c5152ba3134c617bcb05370b92 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 25 Apr 2016 21:19:51 -0400 Subject: [PATCH] v0.3.5: Warrior's seal can no longer 'steal' upgrades --- .../items/armor/Armor.java | 38 +++++++++++-------- .../items/armor/ClassArmor.java | 8 ++-- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 30ca7ecaf..cf432d83d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -64,7 +64,7 @@ public class Armor extends EquipableItem { private int hitsToKnow = HITS_TO_KNOW; public Glyph glyph; - public boolean seal; + private BrokenSeal seal; public Armor( int tier ) { @@ -92,21 +92,25 @@ public class Armor extends EquipableItem { hitsToKnow = HITS_TO_KNOW; } inscribe((Glyph) bundle.get(GLYPH)); - seal = bundle.getBoolean(SEAL); - if (seal) unique = true; + //TODO holdover from beta releases, remove in 0.4.0 + if (bundle.getBoolean(SEAL)){ + seal = new BrokenSeal(); + if (level() > 0) seal.level(1); + } else + seal = (BrokenSeal)bundle.get(SEAL); } @Override public void reset() { super.reset(); //armor can be kept in bones between runs, the seal cannot. - seal = false; + seal = null; } @Override public ArrayList actions(Hero hero) { ArrayList actions = super.actions(hero); - if (seal) actions.add(AC_DETACH); + if (seal != null) actions.add(AC_DETACH); return actions; } @@ -115,14 +119,11 @@ public class Armor extends EquipableItem { super.execute(hero, action); - if (action.equals(AC_DETACH) && seal){ - seal = false; + if (action.equals(AC_DETACH) && seal != null){ BrokenSeal.WarriorShield sealBuff = hero.buff(BrokenSeal.WarriorShield.class); if (sealBuff != null) sealBuff.setArmor(null); - BrokenSeal seal = new BrokenSeal(); - if (level() > 0){ - seal.upgrade(); + if (seal.level() > 0){ degrade(); } GLog.i( Messages.get(Armor.class, "detach_seal") ); @@ -130,6 +131,7 @@ public class Armor extends EquipableItem { if (!seal.collect()){ Dungeon.level.drop(seal, hero.pos); } + seal = null; } } @@ -164,11 +166,11 @@ public class Armor extends EquipableItem { @Override 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){ - this.seal = true; + this.seal = seal; if (seal.level() > 0){ //doesn't override existing glyphs, but doesn't create one either upgrade(glyph != null); @@ -178,6 +180,10 @@ public class Armor extends EquipableItem { } } + public BrokenSeal checkSeal(){ + return seal; + } + @Override protected float time2equip( Hero hero ) { return 2 / hero.speed(); @@ -229,6 +235,9 @@ public class Armor extends EquipableItem { } } + if (seal != null && seal.level() == 0) + seal.upgrade(); + STR--; return super.upgrade(); @@ -294,7 +303,7 @@ public class Armor extends EquipableItem { info += "\n\n" + Messages.get(Armor.class, "cursed_worn"); } else if (cursedKnown && 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"); } @@ -303,7 +312,7 @@ public class Armor extends EquipableItem { @Override public Emitter emitter() { - if (!seal) return super.emitter(); + if (seal == null) return super.emitter(); Emitter emitter = new Emitter(); emitter.pos(10f, 6f); emitter.fillTarget = false; @@ -346,7 +355,6 @@ public class Armor extends EquipableItem { @Override public int price() { - if (seal) return 0; int price = 10 * (1 << (tier - 1)); if (glyph != null) { price *= 1.5; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index 7d272a394..34178278c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -20,8 +20,6 @@ */ 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.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal; @@ -56,9 +54,9 @@ abstract public class ClassArmor extends Armor { switch (owner.heroClass) { case WARRIOR: classArmor = new WarriorArmor(); - classArmor.seal = armor.seal; - if (armor.seal && armor.isEquipped(owner)){ - Buff.affect(Dungeon.hero, BrokenSeal.WarriorShield.class).setArmor(classArmor); + BrokenSeal seal = armor.checkSeal(); + if (seal != null) { + classArmor.affixSeal(seal); } break; case ROGUE: