diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java index d19248d9d..e03f21287 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Hunger.java @@ -127,10 +127,6 @@ public class Hunger extends Buff implements Hero.Doom { } public void satisfy( float energy ) { - if (((Hero) target).subClass == HeroSubClass.WARLOCK){ - Buff.affect( target, ScrollOfRecharging.Recharging.class, energy/50f); - return; - } Artifact.ArtifactBuff buff = target.buff( HornOfPlenty.hornRecharge.class ); if (buff != null && buff.isCursed()){ @@ -142,17 +138,6 @@ public class Hunger extends Buff implements Hero.Doom { reduceHunger( energy ); } - public void consumeSoul( float energy ){ - - if (level >= STARVING) - energy *= 1.33f; - else if (level < HUNGRY) - energy *= 0.67f; - - if (!Dungeon.isChallenged(Challenges.NO_FOOD)) - reduceHunger( energy ); - } - //directly interacts with hunger, no checks. public void reduceHunger( float energy ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/SoulMark.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/SoulMark.java new file mode 100644 index 000000000..597cc3406 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/SoulMark.java @@ -0,0 +1,61 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2015 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; + +public class SoulMark extends FlavourBuff { + + public static final float DURATION = 50f; + + { + type = buffType.NEGATIVE; + } + + @Override + public int icon() { + return BuffIndicator.CORRUPT; + } + + @Override + public String toString() { + return "Soul Marked"; + } + + @Override + public boolean attachTo(Char target) { + if (super.attachTo(target) && target.sprite != null){ + target.sprite.emitter().burst(ShadowParticle.UP, 10); + return true; + } else + return false; + } + + @Override + public String desc() { + return "The warlock has tapped into the soul of this creature. " + + "He will heal and satisfy his hunger as it takes physical damage.\n" + + "\n" + + "This mark will last for " + dispTurns() + "."; + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 82578e1b4..00a256bb6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1101,17 +1101,6 @@ public class Hero extends Char { EtherealChains.chainsRecharge chains = buff(EtherealChains.chainsRecharge.class); if (chains != null) chains.gainExp(percent); - - if (subClass == HeroSubClass.WARLOCK) { - - int healed = Math.round(Math.min(HT - HP, HT * percent * 0.3f)); - if (healed > 0) { - HP += healed; - sprite.emitter().burst( Speck.factory( Speck.HEALING ), percent > 0.3f ? 2 : 1 ); - } - - (buff( Hunger.class )).consumeSoul( Hunger.STARVING*percent ); - } boolean levelUp = false; while (this.exp >= maxExp()) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java index 6ca6a8dc8..f517b3060 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroSubClass.java @@ -34,8 +34,8 @@ public enum HeroSubClass { "significantly increasing his damage output." ), WARLOCK( "warlock", - "Normal food grants the _Warlock_ additional wand recharge, but does not satisfy his hunger. " + - "Instead, after killing an enemy, he consumes its soul to heal his wounds and satisfy hunger." ), + "When using wands on an enemy, the _Warlock_ has a chance to mark their soul. " + + "Marked enemies will heal him and restore his hunger whenever they take physical damage."), BATTLEMAGE( "battlemage", "When fighting with his staff, the _Battlemage_ conjures bonus effects depending on the wand " + "his staff is imbued with. His staff will also gain charge through combat." ), diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 49e064c9f..6dfe41f7d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -29,10 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Amok; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; +import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Surprise; import com.shatteredpixel.shatteredpixeldungeon.effects.Wound; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -373,6 +376,13 @@ public abstract class Mob extends Char { state = HUNTING; } + if (buff(SoulMark.class) != null) { + int restoration = Math.max(damage, HP); + Dungeon.hero.buff(Hunger.class).satisfy(restoration*0.5f); + Dungeon.hero.HP = (int)Math.ceil(Math.min(Dungeon.hero.HT, Dungeon.hero.HP+(restoration*0.25f))); + Dungeon.hero.sprite.emitter().burst( Speck.factory(Speck.HEALING), 1 ); + } + return damage; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 830b198b7..479a4cdfd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -22,7 +22,10 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import java.util.ArrayList; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.SoulMark; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.watabou.noosa.audio.Sample; @@ -132,6 +135,14 @@ public abstract class Wand extends Item { charger.setScaleFactor( chargeScaleFactor ); } + protected void processSoulMark(Char target, int chargesUsed){ + if (target != Dungeon.hero && + Dungeon.hero.subClass == HeroSubClass.WARLOCK && + Random.Float() < .08f + (level*chargesUsed*0.04f)){ + SoulMark.prolong(target, SoulMark.class, SoulMark.DURATION); + } + } + @Override public void onDetach( ) { stopCharging(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 2f42c42c6..1a3f6766b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -73,6 +73,7 @@ public class WandOfBlastWave extends Wand { Char ch = Actor.findChar(bolt.collisionPos + i); if (ch != null){ + processSoulMark(ch, chargesPerCast()); ch.damage(damage, this); if (ch.isAlive()) { @@ -86,6 +87,7 @@ public class WandOfBlastWave extends Wand { //throws the char at the center of the blast Char ch = Actor.findChar(bolt.collisionPos); if (ch != null){ + processSoulMark(ch, chargesPerCast()); ch.damage(damage, this); if (ch.isAlive() && bolt.path.size() > bolt.dist+1) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index ebf00576e..a0938b9cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -104,6 +104,8 @@ public class WandOfCorruption extends Wand { ch.HP = ch.HT; curCharges -= extraCharges; usagesToKnow -= extraCharges; + + processSoulMark(ch, extraCharges+chargesPerCast()); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java index cb0fdbfe2..cac8afb0a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java @@ -95,6 +95,7 @@ public class WandOfDisintegration extends Wand { int dmgMin = lvl; int dmgMax = (int) (8 + lvl * lvl / 3f); for (Char ch : chars) { + processSoulMark(ch, chargesPerCast()); ch.damage( Random.NormalIntRange( dmgMin, dmgMax ), this ); ch.sprite.centerEmitter().burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) ); ch.sprite.flash(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java index fef7019f1..065997262 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java @@ -68,6 +68,7 @@ public class WandOfFrost extends Wand { ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 ); } + processSoulMark(ch, chargesPerCast()); ch.damage(damage, this); if (ch.isAlive()){ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index 26e189ec1..5b4f54f48 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -64,6 +64,7 @@ public class WandOfLightning extends Wand { int max = Math.round(10 + (level * level / 4f)); for (Char ch : affected){ + processSoulMark(ch, chargesPerCast()); ch.damage(Math.round(Random.NormalIntRange(min, max) * multipler), LightningTrap.LIGHTNING); if (ch == Dungeon.hero) Camera.main.shake( 2, 0.3f ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java index a7f5a0910..85edae8b3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java @@ -45,6 +45,7 @@ public class WandOfMagicMissile extends Wand { int level = level(); + processSoulMark(ch, chargesPerCast()); ch.damage(Random.NormalIntRange(4 , 6 + level * 2), this); ch.sprite.burst(0xFFFFFFFF, level / 2 + 2); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java index a4bc037ef..a1cb7421c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java @@ -84,7 +84,8 @@ public class WandOfPrismaticLight extends Wand { protected void onZap(Ballistica beam) { Char ch = Actor.findChar(beam.collisionPos); if (ch != null){ - affectTarget(ch); + processSoulMark(ch, chargesPerCast()); + affectTarget(ch); } affectMap(beam); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index e9138cebf..493939c67 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.wands; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; @@ -96,6 +97,11 @@ public class WandOfRegrowth extends Wand { Level.set( i, Terrain.GRASS ); } + Char ch = Actor.findChar(i); + if (ch != null){ + processSoulMark(ch, chargesPerCast()); + } + GameScene.add( Blob.seed( i, 10, Regrowth.class ) ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java index 9090951c2..83a86ebe3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java @@ -102,6 +102,8 @@ public class WandOfTransfusion extends Wand { //if we find a character.. if (ch != null && ch instanceof Mob){ + processSoulMark(ch, chargesPerCast()); + //heals an ally, or charmed/corrupted enemy if (((Mob) ch).ally || ch.buff(Charm.class) != null || ch.buff(Corruption.class) != null){ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java index 99b164666..567b44e13 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.VenomGas; @@ -47,6 +48,11 @@ public class WandOfVenom extends Wand { Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class); ((VenomGas)venomGas).setStrength(level+1); GameScene.add(venomGas); + + Char ch = Actor.findChar(bolt.collisionPos); + if (ch != null){ + processSoulMark(ch, chargesPerCast()); + } } @Override