From 110631ea7702f6b71e4c07dad826cc5a8fecaa68 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 11 Sep 2014 16:45:19 -0400 Subject: [PATCH] V0.2.0: Implemented Ring of Tenacity --- .../shatteredpixeldungeon/actors/hero/Hero.java | 10 ++++++++++ .../items/rings/RingOfTenacity.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index b4b2f1172..feecc35aa 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfForce; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfTenacity; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.audio.Sample; @@ -831,6 +832,15 @@ public class Hero extends Char { Buff.detach(this, Drowsy.class); GLog.w("The pain helps you resist the urge to sleep."); } + + int tenacity = 0; + for (Buff buff : buffs(RingOfTenacity.Tenacity.class)) { + tenacity += ((RingOfTenacity.Tenacity)buff).level; + } + //TODO: test if this works + if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health. + dmg *= Math.pow(0.9, tenacity*((float)(HT - HP)/HT)); + super.damage( dmg, src ); if (subClass == HeroSubClass.BERSERKER && 0 < HP && HP <= HT * Fury.LEVEL) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java index 193cc79c5..b145a19ed 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java @@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; * Created by debenhame on 10/09/2014. */ public class RingOfTenacity extends Ring { - //TODO: tie this into game logic + //TODO: testing, numbers tweaking { name = "Ring of Tenacity"; }