v3.0.0: fixed stasis buff durations, and added life linking in stasis

This commit is contained in:
Evan Debenham
2025-02-18 14:59:46 -05:00
parent 7fe16afe6a
commit 32990e19a5
4 changed files with 40 additions and 15 deletions

View File

@@ -91,7 +91,12 @@ public abstract class Actor implements Bundlable {
}
public void clearTime() {
time = 0;
spendConstant(-Actor.now());
if (this instanceof Char){
for (Buff b : ((Char) this).buffs()){
b.spendConstant(-Actor.now());
}
}
}
public void timeToNow() {

View File

@@ -24,7 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.PowerOfMany;
@@ -119,13 +121,15 @@ public class BeamingRay extends TargetedClericSpell {
}
if (ally == Stasis.getStasisAlly()){
//TODO buffs
ally.pos = telePos;
ally.clearTime();
GameScene.add((Mob) ally);
hero.buff(Stasis.StasisBuff.class).detach();
hero.sprite.parent.add(
new Beam.SunRay(hero.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(telePos)));
if (ally.buff(LifeLink.class) != null){
Buff.prolong(Dungeon.hero, LifeLink.class, ally.buff(LifeLink.class).cooldown()).object = ally.id();
}
} else {
hero.sprite.parent.add(
new Beam.SunRay(ally.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(telePos)));

View File

@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.Pow
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
@@ -54,7 +55,7 @@ public class LifeLinkSpell extends ClericSpell {
public boolean canCast(Hero hero) {
return super.canCast(hero)
&& hero.hasTalent(Talent.LIFE_LINK)
&& PowerOfMany.getPoweredAlly() != null;
&& (PowerOfMany.getPoweredAlly() != null || Stasis.getStasisAlly() != null);
}
@Override
@@ -65,19 +66,31 @@ public class LifeLinkSpell extends ClericSpell {
@Override
public void onCast(HolyTome tome, Hero hero) {
Char ally = PowerOfMany.getPoweredAlly();
hero.sprite.zap(ally.pos);
hero.sprite.parent.add(
new Beam.HealthRay(hero.sprite.center(), ally.sprite.center()));
int duration = 4 + 2*hero.pointsInTalent(Talent.LIFE_LINK);
Buff.prolong(hero, LifeLink.class, duration).object = ally.id();
Buff.prolong(ally, LifeLink.class, duration).object = hero.id();
Char ally = PowerOfMany.getPoweredAlly();
if (ally != null) {
hero.sprite.zap(ally.pos);
hero.sprite.parent.add(
new Beam.HealthRay(hero.sprite.center(), ally.sprite.center()));
Buff.prolong(hero, LifeLink.class, duration).object = ally.id();
} else {
ally = Stasis.getStasisAlly();
hero.sprite.operate(hero.pos);
hero.sprite.parent.add(
new Beam.HealthRay(DungeonTilemap.tileCenterToWorld(hero.pos), hero.sprite.center()));
}
Buff.prolong(ally, LifeLink.class, duration).object = hero.id();
Buff.prolong(ally, LifeLinkSpellBuff.class, duration);
if (ally == Stasis.getStasisAlly()){
ally.buff(LifeLink.class).clearTime();
ally.buff(LifeLinkSpellBuff.class).clearTime();
}
hero.spendAndNext(Actor.TICK);
onSpellCast(tome, hero);

View File

@@ -93,7 +93,6 @@ public class Stasis extends ClericSpell {
hero.sprite.zap(ally.pos);
MagicMissile.boltFromChar(hero.sprite.parent, MagicMissile.LIGHT_MISSILE, ally.sprite, hero.pos, null);
//TODO need to preserve buffs properly, this half works, makes durations wacky (based on current Actor.now values)
LinkedHashSet<Buff> buffs = ally.buffs();
Actor.remove(ally);
ally.sprite.killAndErase();
@@ -104,6 +103,7 @@ public class Stasis extends ClericSpell {
ally.add(b);
}
}
ally.clearTime();
Buff.prolong(hero, StasisBuff.class, 20 + 20*hero.pointsInTalent(Talent.STASIS)).stasisAlly = (Mob)ally;
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
@@ -112,7 +112,7 @@ public class Stasis extends ClericSpell {
hero.buff(LifeLink.class).detach();
}
//TODO need code in beaming ray and life link to work here, also life link cleric spells?
//TODO life link cleric spells?
hero.spendAndNext(Actor.TICK);
Dungeon.observe();
@@ -162,13 +162,16 @@ public class Stasis extends ClericSpell {
spawnPoints.add(target.pos + PathFinder.NEIGHBOURS8[Random.Int(8)]);
}
stasisAlly.pos = Random.element(spawnPoints);
stasisAlly.clearTime();
GameScene.add(stasisAlly);
if (stasisAlly instanceof DirectableAlly){
((DirectableAlly) stasisAlly).clearDefensingPos();
}
if (stasisAlly.buff(LifeLink.class) != null){
Buff.prolong(Dungeon.hero, LifeLink.class, stasisAlly.buff(LifeLink.class).cooldown()).object = stasisAlly.id();
}
ScrollOfTeleportation.appear(stasisAlly, stasisAlly.pos);
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);