v0.3.0: buffed cape of thorns, now reduces damage from all types of attacks, but only deflects it back if the attacker is adjacent.

This commit is contained in:
Evan Debenham 2015-05-20 09:35:52 -04:00 committed by Evan Debenham
parent 772058af8d
commit ac6e8173e9
2 changed files with 13 additions and 10 deletions

View File

@ -895,11 +895,6 @@ public class Hero extends Char {
@Override @Override
public int defenseProc( Char enemy, int damage ) { public int defenseProc( Char enemy, int damage ) {
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
if (thorns != null) {
damage = thorns.proc(damage, enemy);
}
Earthroot.Armor armor = buff( Earthroot.Armor.class ); Earthroot.Armor armor = buff( Earthroot.Armor.class );
if (armor != null) { if (armor != null) {
damage = armor.absorb( damage ); damage = armor.absorb( damage );
@ -932,6 +927,11 @@ public class Hero extends Char {
GLog.w("The pain helps you resist the urge to sleep."); GLog.w("The pain helps you resist the urge to sleep.");
} }
CapeOfThorns.Thorns thorns = buff( CapeOfThorns.Thorns.class );
if (thorns != null) {
dmg = thorns.proc(dmg, (src instanceof Char ? (Char)src : null), this);
}
int tenacity = 0; int tenacity = 0;
for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) { for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) {
tenacity += ((RingOfTenacity.Tenacity)buff).level; tenacity += ((RingOfTenacity.Tenacity)buff).level;

View File

@ -2,6 +2,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -40,10 +41,10 @@ public class CapeOfThorns extends Artifact {
desc += "\n\n"; desc += "\n\n";
if (cooldown == 0) if (cooldown == 0)
desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " + desc += "The cape feels reassuringly heavy on your shoulders. You're not sure if it will directly " +
"help you in a fight, but it seems to be gaining energy from the physical damage you take."; "help you in a fight, but it seems to be gaining energy from the damage you take.";
else else
desc += "The cape seems to be releasing some stored energy, it is radiating power at all angles. " + desc += "The cape seems to be releasing some stored energy, " +
"You feel very confident that the cape can protect you from nearby enemies right now."; "it is radiating a protective power at all angles. ";
} }
return desc; return desc;
@ -65,7 +66,7 @@ public class CapeOfThorns extends Artifact {
return true; return true;
} }
public int proc(int damage, Char attacker){ public int proc(int damage, Char attacker, Char defender){
if (cooldown == 0){ if (cooldown == 0){
charge += damage*(0.5+level*0.05); charge += damage*(0.5+level*0.05);
if (charge >= chargeCap){ if (charge >= chargeCap){
@ -80,7 +81,9 @@ public class CapeOfThorns extends Artifact {
int deflected = Random.NormalIntRange(0, damage); int deflected = Random.NormalIntRange(0, damage);
damage -= deflected; damage -= deflected;
attacker.damage(deflected, this); if (attacker != null && Level.adjacent(attacker.pos, defender.pos)) {
attacker.damage(deflected, this);
}
exp+= deflected; exp+= deflected;