v0.9.4: magic immunity now also cleanses existing magic debuffs
This commit is contained in:
parent
3dab4ba6ac
commit
778ad3f28c
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
@ -39,7 +40,24 @@ public class MagicImmune extends FlavourBuff {
|
||||||
immunities.addAll(AntiMagic.RESISTS);
|
immunities.addAll(AntiMagic.RESISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME what about active buffs/debuffs?, what about rings? what about artifacts?
|
//FIXME still a lot of cases not handled here, e.g. rings/artifacts and various damage sources
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean attachTo(Char target) {
|
||||||
|
if (super.attachTo(target)){
|
||||||
|
for (Buff b : target.buffs()){
|
||||||
|
for (Class immunity : immunities){
|
||||||
|
if (b.getClass().isAssignableFrom(immunity)){
|
||||||
|
b.detach();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int icon() {
|
public int icon() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user