v0.8.0: fixed various errors with life link

This commit is contained in:
Evan Debenham 2020-02-12 18:53:33 -05:00
parent ea563afd40
commit ac8d44c6fd
2 changed files with 16 additions and 1 deletions
core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors

View File

@ -423,7 +423,7 @@ public abstract class Char extends Actor {
link.detach();
}
}
dmg /= (links.size()+1);
dmg = (int)Math.ceil(dmg / (float)(links.size()+1));
for (LifeLink link : links){
Char ch = (Char)Actor.findById(link.object);
ch.damage(dmg, LifeLink.class);

View File

@ -21,6 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.utils.Bundle;
@ -36,6 +38,19 @@ public class LifeLink extends FlavourBuff {
announced = true;
}
@Override
public void detach() {
super.detach();
Char ch = (Char)Actor.findById(object);
if (!target.isAlive() && ch != null){
for (LifeLink l : ch.buffs(LifeLink.class)){
if (l.object == target.id()){
l.detach();
}
}
}
}
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );