v0.8.0: added a new life link buff, which will be used in the DK fight
This commit is contained in:
parent
3697b1b8c6
commit
e611f1a6ea
|
@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FrostImbue;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
||||||
|
@ -413,6 +414,25 @@ public abstract class Char extends Actor {
|
||||||
if (!isAlive() || dmg < 0) {
|
if (!isAlive() || dmg < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src != LifeLink.class && buff(LifeLink.class) != null){
|
||||||
|
HashSet<LifeLink> links = buffs(LifeLink.class);
|
||||||
|
for (LifeLink link : links.toArray(new LifeLink[0])){
|
||||||
|
if (Actor.findById(link.object) == null){
|
||||||
|
links.remove(link);
|
||||||
|
link.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dmg /= (links.size()+1);
|
||||||
|
for (LifeLink link : links){
|
||||||
|
Char ch = (Char)Actor.findById(link.object);
|
||||||
|
ch.damage(dmg, LifeLink.class);
|
||||||
|
if (!ch.isAlive()){
|
||||||
|
link.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Terror t = buff(Terror.class);
|
Terror t = buff(Terror.class);
|
||||||
if (t != null){
|
if (t != null){
|
||||||
t.recover();
|
t.recover();
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2020 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
|
import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
|
public class LifeLink extends FlavourBuff {
|
||||||
|
|
||||||
|
public int object = 0;
|
||||||
|
|
||||||
|
private static final String OBJECT = "object";
|
||||||
|
|
||||||
|
{
|
||||||
|
type = buffType.POSITIVE;
|
||||||
|
announced = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void storeInBundle( Bundle bundle ) {
|
||||||
|
super.storeInBundle( bundle );
|
||||||
|
bundle.put( OBJECT, object );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
|
super.restoreFromBundle( bundle );
|
||||||
|
object = bundle.getInt( OBJECT );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int icon() {
|
||||||
|
return BuffIndicator.HEART;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Messages.get(this, "name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return Messages.get(this, "desc", dispTurns());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -186,6 +186,9 @@ actors.buffs.invisibility.desc=You are completely blended into the surrounding t
|
||||||
actors.buffs.levitation.name=Levitating
|
actors.buffs.levitation.name=Levitating
|
||||||
actors.buffs.levitation.desc=A magical force is levitating you over the ground, making you feel weightless.\n\nWhile levitating you ignore all ground-based effects. Traps won't trigger, water won't put out fire, plants won't be trampled, roots will miss you, and you will hover right over pits. Be careful, as all these things can come into effect the second the levitation ends!\n\nTurns of levitation remaining: %s.
|
actors.buffs.levitation.desc=A magical force is levitating you over the ground, making you feel weightless.\n\nWhile levitating you ignore all ground-based effects. Traps won't trigger, water won't put out fire, plants won't be trampled, roots will miss you, and you will hover right over pits. Be careful, as all these things can come into effect the second the levitation ends!\n\nTurns of levitation remaining: %s.
|
||||||
|
|
||||||
|
actors.buffs.lifelink.name=Life Link
|
||||||
|
actors.buffs.lifelink.desc=This characters's life force is linked to another character nearby. Any damage taken is shared between them.\n\nWhenever this character takes damage, half of it will be dealt to the life link target instead.\n\nTurns of life link remaining: %s, or until the linked character dies.
|
||||||
|
|
||||||
actors.buffs.light.name=Illuminated
|
actors.buffs.light.name=Illuminated
|
||||||
actors.buffs.light.desc=Even in the Darkest Dungeon, a steady light at your side is always comforting.\n\nLight helps keep darkness at bay, allowing you to see a reasonable distance despite the environment.\n\nTurns of illumination remaining: %s.
|
actors.buffs.light.desc=Even in the Darkest Dungeon, a steady light at your side is always comforting.\n\nLight helps keep darkness at bay, allowing you to see a reasonable distance despite the environment.\n\nTurns of illumination remaining: %s.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user