v1.2.0: fixed armband being able to steal items blocked by challenges

This commit is contained in:
Evan Debenham 2022-03-21 21:00:49 -04:00
parent 599a758f15
commit c35e750ff0

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@ -140,14 +141,19 @@ public class MasterThievesArmband extends Artifact {
GLog.w(Messages.get(MasterThievesArmband.class, "no_steal")); GLog.w(Messages.get(MasterThievesArmband.class, "no_steal"));
} else if (Random.Float() <= lootChance){ } else if (Random.Float() <= lootChance){
Item loot = ((Mob) ch).createLoot(); Item loot = ((Mob) ch).createLoot();
if (loot.doPickUp(curUser)){ if (Challenges.isItemBlocked(loot)){
GLog.i(Messages.get(MasterThievesArmband.class, "failed_steal"));
Buff.affect(ch, StolenTracker.class).setItemStolen(false);
} else {
if (loot.doPickUp(curUser)) {
//item collection happens instantly //item collection happens instantly
curUser.spend(-TIME_TO_PICK_UP); curUser.spend(-TIME_TO_PICK_UP);
} else { } else {
Dungeon.level.drop( loot, curUser.pos ).sprite.drop(); Dungeon.level.drop(loot, curUser.pos).sprite.drop();
} }
GLog.i(Messages.get(MasterThievesArmband.class, "stole_item", loot.name())); GLog.i(Messages.get(MasterThievesArmband.class, "stole_item", loot.name()));
Buff.affect(ch, StolenTracker.class).setItemStolen(true); Buff.affect(ch, StolenTracker.class).setItemStolen(true);
}
} else { } else {
GLog.i(Messages.get(MasterThievesArmband.class, "failed_steal")); GLog.i(Messages.get(MasterThievesArmband.class, "failed_steal"));
Buff.affect(ch, StolenTracker.class).setItemStolen(false); Buff.affect(ch, StolenTracker.class).setItemStolen(false);