v0.8.0: fixed .class instead of reference when damaging in some cases

This commit is contained in:
Evan Debenham 2020-02-12 19:06:43 -05:00
parent ac8d44c6fd
commit 0277224f7e
4 changed files with 5 additions and 5 deletions

View File

@ -415,7 +415,7 @@ public abstract class Char extends Actor {
return; return;
} }
if (src != LifeLink.class && buff(LifeLink.class) != null){ if (!(src instanceof LifeLink) && buff(LifeLink.class) != null){
HashSet<LifeLink> links = buffs(LifeLink.class); HashSet<LifeLink> links = buffs(LifeLink.class);
for (LifeLink link : links.toArray(new LifeLink[0])){ for (LifeLink link : links.toArray(new LifeLink[0])){
if (Actor.findById(link.object) == null){ if (Actor.findById(link.object) == null){
@ -426,7 +426,7 @@ public abstract class Char extends Actor {
dmg = (int)Math.ceil(dmg / (float)(links.size()+1)); dmg = (int)Math.ceil(dmg / (float)(links.size()+1));
for (LifeLink link : links){ for (LifeLink link : links){
Char ch = (Char)Actor.findById(link.object); Char ch = (Char)Actor.findById(link.object);
ch.damage(dmg, LifeLink.class); ch.damage(dmg, link);
if (!ch.isAlive()){ if (!ch.isAlive()){
link.detach(); link.detach();
} }

View File

@ -1005,7 +1005,7 @@ public class NewTengu extends Mob {
Char ch = Actor.findChar(cell); Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)){ if (ch != null && !(ch instanceof NewTengu)){
ch.damage(2 + Dungeon.depth, Electricity.class); ch.damage(2 + Dungeon.depth, new Electricity());
if (ch == Dungeon.hero && !ch.isAlive()) { if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(NewTengu.class); Dungeon.fail(NewTengu.class);

View File

@ -108,7 +108,7 @@ public class Pylon extends Mob {
private void shockChar( Char ch ){ private void shockChar( Char ch ){
if (ch != null && !(ch instanceof NewDM300)){ if (ch != null && !(ch instanceof NewDM300)){
ch.sprite.flash(); ch.sprite.flash();
ch.damage(Random.NormalIntRange(10, 20), Electricity.class); ch.damage(Random.NormalIntRange(10, 20), new Electricity());
if (ch == Dungeon.hero && !ch.isAlive()){ if (ch == Dungeon.hero && !ch.isAlive()){
Dungeon.fail(NewDM300.class); Dungeon.fail(NewDM300.class);

View File

@ -53,7 +53,7 @@ public class MageArmor extends ClassArmor {
&& mob.alignment != Char.Alignment.ALLY) { && mob.alignment != Char.Alignment.ALLY) {
Buff.affect( mob, Burning.class ).reignite( mob ); Buff.affect( mob, Burning.class ).reignite( mob );
Buff.prolong( mob, Roots.class, 5 ); Buff.prolong( mob, Roots.class, 5 );
mob.damage(Random.NormalIntRange(4, 16 + Dungeon.depth), Burning.class); mob.damage(Random.NormalIntRange(4, 16 + Dungeon.depth), new Burning());
} }
} }