From b0b0d38a573a78fc47152feda09df66b0f1ad6b4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 30 Nov 2020 13:13:08 -0500 Subject: [PATCH] v0.9.1: implemented the wand preservation talent --- core/src/main/assets/messages/items/items.properties | 1 + .../items/weapon/melee/MagesStaff.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index b34734ccc..750fc2555 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1396,6 +1396,7 @@ items.weapon.melee.magesstaff.ac_imbue=IMBUE items.weapon.melee.magesstaff.ac_zap=ZAP items.weapon.melee.magesstaff.prompt=Select a wand items.weapon.melee.magesstaff.imbue=You imbue your staff with the %s. +items.weapon.melee.magesstaff.preserved=The previous wand was preserved! items.weapon.melee.magesstaff.conflict=The conflicting magics erase the enchantment on your staff. items.weapon.melee.magesstaff.id_first=You'll need to identify this wand first. items.weapon.melee.magesstaff.cursed=You can't use a cursed wand. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 15afbb8b3..42cae83a7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; @@ -187,6 +188,16 @@ public class MagesStaff extends MeleeWeapon { public Item imbueWand(Wand wand, Char owner){ + if (owner == Dungeon.hero && Dungeon.hero.hasTalent(Talent.WAND_PRESERVATION) + && Random.Float() < 0.3f + 0.3f*Dungeon.hero.pointsInTalent(Talent.WAND_PRESERVATION)){ + this.wand.level(0); + if (!this.wand.collect()){ + Dungeon.level.drop(this.wand, owner.pos); + } + GLog.newLine(); + GLog.p(Messages.get(this, "preserved")); + } + this.wand = null; //syncs the level of the two items.