diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 60ed89387..9418f0d7d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -20,6 +20,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import java.util.ArrayList; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -125,6 +126,8 @@ public abstract class Wand extends KindOfWeapon { protected abstract void onZap( Ballistica attack ); + public abstract void onHit( MagesStaff staff, Char attacker, Char defender, int damage); + @Override public boolean collect( Bag container ) { if (super.collect( container )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java index e0ab61dd4..cab9533f8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAmok.java @@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -54,6 +55,11 @@ public class WandOfAmok extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.purpleLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java index 60d2af479..8792b21fe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfAvalanche.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.Camera; import com.watabou.noosa.audio.Sample; @@ -87,6 +88,11 @@ public class WandOfAvalanche extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.earth( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java index a6c5c716a..9cb7840ad 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlink.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.tweeners.AlphaTweener; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -50,7 +51,12 @@ public class WandOfBlink extends Wand { appear( Dungeon.hero, bolt.collisionPos ); Dungeon.observe(); } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.whiteLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java index 0143dfb41..7787b254a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java @@ -26,6 +26,8 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.DeathRay; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Death; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; @@ -92,7 +94,14 @@ public class WandOfDisintegration extends Wand { ch.sprite.flash(); } } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //less likely Grim proc + if (Random.Int(10) == 0) + new Death().proc( staff, attacker, defender, damage); + } + private int distance() { return level() + 4; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFirebolt.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFirebolt.java index c917ee4aa..a6fc0610c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFirebolt.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFirebolt.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -30,11 +31,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; +import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.Random; @@ -75,6 +78,13 @@ public class WandOfFirebolt extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //acts like blazing enchantment, package conflict..... + new com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Fire() + .proc( staff, attacker, defender, damage); + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.fire( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java index 775ebb4df..225f8fcb0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFlock.java @@ -18,6 +18,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -96,7 +97,12 @@ public class WandOfFlock extends Wand { } while (dist < n); } } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + protected void fx( int cell, Callback callback ) { MagicMissile.wool( curUser.sprite.parent, curUser.pos, cell, callback ); Sample.INSTANCE.play( Assets.SND_ZAP ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index 7ed6521f4..47e652fb8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -20,6 +20,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import java.util.ArrayList; import java.util.HashSet; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shock; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.Camera; @@ -57,7 +59,13 @@ public class WandOfLightning extends Wand { GLog.n( "You killed yourself with your own Wand of Lightning..." ); } } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //acts like shocking enchantment + new Shock().proc(staff, attacker, defender, damage); + } + private void hit( Char ch, int damage ) { if (damage < 1) { @@ -96,7 +104,7 @@ public class WandOfLightning extends Wand { points[nPoints++] = Dungeon.hero.pos; int cell = bolt.collisionPos; - + Char ch = Actor.findChar( cell ); if (ch != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java index 4b23c71fa..297f159b2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java @@ -24,8 +24,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -85,7 +87,14 @@ public class WandOfMagicMissile extends Wand { } } } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //regains lvl*5% of total missing charge + partialCharge += ((maxCharges - curCharges)/20f)*staff.level; + SpellSprite.show(attacker, SpellSprite.CHARGE); + } + @Override public void execute( Hero hero, String action ) { if (action.equals( AC_DISENCHANT )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java index a08286944..4cc85fa5e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPoison.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; @@ -50,6 +51,11 @@ public class WandOfPoison extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.poison( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index 906ae3d31..be82b5514 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -17,6 +17,10 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; +import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -30,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Callback; +import com.watabou.utils.Random; public class WandOfRegrowth extends Wand { @@ -69,6 +74,21 @@ public class WandOfRegrowth extends Wand { } @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + //like vampiric enchantment, except with herbal healing buff + + int level = Math.max( 0, 0/*staff level*/ ); + + // lvl 0 - 33% + // lvl 1 - 43% + // lvl 2 - 50% + int maxValue = damage * (level + 2) / (level + 6); + int effValue = Math.min( Random.IntRange(0, maxValue), attacker.HT - attacker.HP ); + + Buff.affect(attacker, Sungrass.Health.class).boost( effValue ); + + } + protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.foliage( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); Sample.INSTANCE.play( Assets.SND_ZAP ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java index 4451bf94c..3117decd1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfSlowness.java @@ -17,6 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; @@ -50,6 +51,11 @@ public class WandOfSlowness extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.slowness( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java index fef9a626b..8eb23c157 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTelekinesis.java @@ -17,6 +17,8 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -130,7 +132,12 @@ public class WandOfTelekinesis extends Wand { } */ } - + + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + private void transport( Heap heap ) { Item item = heap.pickUp(); if (item.doPickUp( curUser )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java index 6c52c6629..9a4cde359 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTeleportation.java @@ -18,6 +18,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -75,6 +76,11 @@ public class WandOfTeleportation extends Wand { } } + @Override + public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { + + } + @Override protected void fx( Ballistica bolt, Callback callback ) { MagicMissile.coldLight( curUser.sprite.parent, bolt.sourcePos, bolt.collisionPos, callback ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index ac6a7b9d3..0dc6153ad 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -4,6 +4,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; @@ -91,6 +92,13 @@ public class MagesStaff extends MeleeWeapon { super.execute(hero, action); } + @Override + public void proc(Char attacker, Char defender, int damage) { + super.proc(attacker, defender, damage); + if (wand != null && Dungeon.hero.subClass == HeroSubClass.BATTLEMAGE) + wand.onHit( this, attacker, defender, damage ); + } + @Override public boolean collect( Bag container ) { if (super.collect( container )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java index 51cb8c439..af6459702 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Sungrass.java @@ -123,6 +123,10 @@ public class Sungrass extends Plant { detach(); return damage; } + + public void boost( int amount ){ + level += amount; + } @Override public int icon() {