v1.4.0: fixed effect order errors with kinetic and viscosity
This commit is contained in:
@@ -79,6 +79,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.PrismaticImage;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
|
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
|
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
|
||||||
@@ -93,6 +94,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazing;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blocking;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Grim;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Shocking;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.ShockingDart;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.ShockingDart;
|
||||||
@@ -385,6 +387,11 @@ public abstract class Char extends Actor {
|
|||||||
int effectiveDamage = enemy.defenseProc( this, Math.round(dmg) );
|
int effectiveDamage = enemy.defenseProc( this, Math.round(dmg) );
|
||||||
effectiveDamage = Math.max( effectiveDamage - dr, 0 );
|
effectiveDamage = Math.max( effectiveDamage - dr, 0 );
|
||||||
|
|
||||||
|
if (enemy.buff(Viscosity.ViscosityTracker.class) != null){
|
||||||
|
effectiveDamage = enemy.buff(Viscosity.ViscosityTracker.class).deferDamage(effectiveDamage);
|
||||||
|
enemy.buff(Viscosity.ViscosityTracker.class).detach();
|
||||||
|
}
|
||||||
|
|
||||||
//vulnerable specifically applies after armor reductions
|
//vulnerable specifically applies after armor reductions
|
||||||
if ( enemy.buff( Vulnerable.class ) != null){
|
if ( enemy.buff( Vulnerable.class ) != null){
|
||||||
effectiveDamage *= 1.33f;
|
effectiveDamage *= 1.33f;
|
||||||
@@ -658,6 +665,13 @@ public abstract class Char extends Actor {
|
|||||||
}
|
}
|
||||||
shielded -= dmg;
|
shielded -= dmg;
|
||||||
HP -= dmg;
|
HP -= dmg;
|
||||||
|
|
||||||
|
if (HP < 0 && src instanceof Char){
|
||||||
|
if (((Char) src).buff(Kinetic.KineticTracker.class) != null){
|
||||||
|
Buff.affect((Char) src, Kinetic.ConservedDamage.class).setBonus(-HP);
|
||||||
|
((Char) src).buff(Kinetic.KineticTracker.class).detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sprite != null) {
|
if (sprite != null) {
|
||||||
sprite.showStatus(HP > HT / 2 ?
|
sprite.showStatus(HP > HT / 2 ?
|
||||||
|
|||||||
+40
-31
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs;
|
|||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
@@ -46,38 +47,10 @@ public class Viscosity extends Glyph {
|
|||||||
@Override
|
@Override
|
||||||
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
|
public int proc( Armor armor, Char attacker, Char defender, int damage ) {
|
||||||
|
|
||||||
//FIXME this glyph should really just proc after DR is accounted for.
|
//we use a tracker so that this glyph can apply after armor
|
||||||
//should build in functionality for that, but this works for now
|
Buff.affect(defender, ViscosityTracker.class).level = armor.buffedLvl();
|
||||||
int realDamage = damage - defender.drRoll();
|
|
||||||
|
|
||||||
//account for icon stomach (just skip the glyph)
|
return damage;
|
||||||
if (defender.buff(Talent.WarriorFoodImmunity.class) != null){
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
//account for huntress armor piercing
|
|
||||||
if (attacker instanceof Hero
|
|
||||||
&& ((Hero) attacker).belongings.weapon() instanceof MissileWeapon
|
|
||||||
&& ((Hero) attacker).subClass == HeroSubClass.SNIPER
|
|
||||||
&& !Dungeon.level.adjacent(attacker.pos, defender.pos)){
|
|
||||||
realDamage = damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (realDamage <= 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int level = Math.max( 0, armor.buffedLvl() );
|
|
||||||
|
|
||||||
float percent = (level+1)/(float)(level+6);
|
|
||||||
int amount = (int)Math.ceil(realDamage * percent);
|
|
||||||
|
|
||||||
DeferedDamage deferred = Buff.affect( defender, DeferedDamage.class );
|
|
||||||
deferred.prolong( amount );
|
|
||||||
|
|
||||||
defender.sprite.showStatus( CharSprite.WARNING, Messages.get(this, "deferred", amount) );
|
|
||||||
|
|
||||||
return damage - amount;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +58,42 @@ public class Viscosity extends Glyph {
|
|||||||
public Glowing glowing() {
|
public Glowing glowing() {
|
||||||
return PURPLE;
|
return PURPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ViscosityTracker extends Buff {
|
||||||
|
|
||||||
|
{
|
||||||
|
actPriority = Actor.VFX_PRIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int level = 0;
|
||||||
|
|
||||||
|
public int deferDamage(int dmg){
|
||||||
|
//account for icon stomach (just skip the glyph)
|
||||||
|
if (target.buff(Talent.WarriorFoodImmunity.class) != null){
|
||||||
|
return dmg;
|
||||||
|
}
|
||||||
|
|
||||||
|
int level = Math.max( 0, this.level );
|
||||||
|
|
||||||
|
float percent = (level+1)/(float)(level+6);
|
||||||
|
int amount = (int)Math.ceil(dmg * percent);
|
||||||
|
|
||||||
|
if (amount > 0){
|
||||||
|
DeferedDamage deferred = Buff.affect( target, DeferedDamage.class );
|
||||||
|
deferred.prolong( amount );
|
||||||
|
|
||||||
|
target.sprite.showStatus( CharSprite.WARNING, Messages.get(Viscosity.class, "deferred", amount) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return dmg - amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean act() {
|
||||||
|
detach();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static class DeferedDamage extends Buff {
|
public static class DeferedDamage extends Buff {
|
||||||
|
|
||||||
|
|||||||
+16
-5
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
@@ -42,12 +43,9 @@ public class Kinetic extends Weapon.Enchantment {
|
|||||||
conservedDamage = attacker.buff(ConservedDamage.class).damageBonus();
|
conservedDamage = attacker.buff(ConservedDamage.class).damageBonus();
|
||||||
attacker.buff(ConservedDamage.class).detach();
|
attacker.buff(ConservedDamage.class).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage > (defender.HP + defender.shielding())){
|
|
||||||
int extraDamage = damage - (defender.HP + defender.shielding());
|
|
||||||
|
|
||||||
Buff.affect(attacker, ConservedDamage.class).setBonus(extraDamage);
|
//use a tracker so that we can know the true final damage
|
||||||
}
|
Buff.affect(attacker, KineticTracker.class);
|
||||||
|
|
||||||
return damage + conservedDamage;
|
return damage + conservedDamage;
|
||||||
}
|
}
|
||||||
@@ -56,6 +54,19 @@ public class Kinetic extends Weapon.Enchantment {
|
|||||||
public ItemSprite.Glowing glowing() {
|
public ItemSprite.Glowing glowing() {
|
||||||
return YELLOW;
|
return YELLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class KineticTracker extends Buff {
|
||||||
|
|
||||||
|
{
|
||||||
|
actPriority = Actor.VFX_PRIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean act() {
|
||||||
|
detach();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static class ConservedDamage extends Buff {
|
public static class ConservedDamage extends Buff {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user