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;
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<String> actions(Hero hero) {
ArrayList<String> 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;

View File

@ -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: