v3.0.0: fixed stasis buff durations, and added life linking in stasis
This commit is contained in:
@@ -91,7 +91,12 @@ public abstract class Actor implements Bundlable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearTime() {
|
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() {
|
public void timeToNow() {
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.FlavourBuff;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.PowerOfMany;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.PowerOfMany;
|
||||||
@@ -119,13 +121,15 @@ public class BeamingRay extends TargetedClericSpell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ally == Stasis.getStasisAlly()){
|
if (ally == Stasis.getStasisAlly()){
|
||||||
//TODO buffs
|
|
||||||
ally.pos = telePos;
|
ally.pos = telePos;
|
||||||
ally.clearTime();
|
|
||||||
GameScene.add((Mob) ally);
|
GameScene.add((Mob) ally);
|
||||||
hero.buff(Stasis.StasisBuff.class).detach();
|
hero.buff(Stasis.StasisBuff.class).detach();
|
||||||
hero.sprite.parent.add(
|
hero.sprite.parent.add(
|
||||||
new Beam.SunRay(hero.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(telePos)));
|
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 {
|
} else {
|
||||||
hero.sprite.parent.add(
|
hero.sprite.parent.add(
|
||||||
new Beam.SunRay(ally.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(telePos)));
|
new Beam.SunRay(ally.sprite.center(), DungeonTilemap.raisedTileCenterToWorld(telePos)));
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.Pow
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ public class LifeLinkSpell extends ClericSpell {
|
|||||||
public boolean canCast(Hero hero) {
|
public boolean canCast(Hero hero) {
|
||||||
return super.canCast(hero)
|
return super.canCast(hero)
|
||||||
&& hero.hasTalent(Talent.LIFE_LINK)
|
&& hero.hasTalent(Talent.LIFE_LINK)
|
||||||
&& PowerOfMany.getPoweredAlly() != null;
|
&& (PowerOfMany.getPoweredAlly() != null || Stasis.getStasisAlly() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,19 +66,31 @@ public class LifeLinkSpell extends ClericSpell {
|
|||||||
@Override
|
@Override
|
||||||
public void onCast(HolyTome tome, Hero hero) {
|
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);
|
int duration = 4 + 2*hero.pointsInTalent(Talent.LIFE_LINK);
|
||||||
|
|
||||||
Buff.prolong(hero, LifeLink.class, duration).object = ally.id();
|
Char ally = PowerOfMany.getPoweredAlly();
|
||||||
Buff.prolong(ally, LifeLink.class, duration).object = hero.id();
|
|
||||||
|
|
||||||
|
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);
|
Buff.prolong(ally, LifeLinkSpellBuff.class, duration);
|
||||||
|
|
||||||
|
if (ally == Stasis.getStasisAlly()){
|
||||||
|
ally.buff(LifeLink.class).clearTime();
|
||||||
|
ally.buff(LifeLinkSpellBuff.class).clearTime();
|
||||||
|
}
|
||||||
|
|
||||||
hero.spendAndNext(Actor.TICK);
|
hero.spendAndNext(Actor.TICK);
|
||||||
|
|
||||||
onSpellCast(tome, hero);
|
onSpellCast(tome, hero);
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ public class Stasis extends ClericSpell {
|
|||||||
hero.sprite.zap(ally.pos);
|
hero.sprite.zap(ally.pos);
|
||||||
MagicMissile.boltFromChar(hero.sprite.parent, MagicMissile.LIGHT_MISSILE, ally.sprite, hero.pos, null);
|
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();
|
LinkedHashSet<Buff> buffs = ally.buffs();
|
||||||
Actor.remove(ally);
|
Actor.remove(ally);
|
||||||
ally.sprite.killAndErase();
|
ally.sprite.killAndErase();
|
||||||
@@ -104,6 +103,7 @@ public class Stasis extends ClericSpell {
|
|||||||
ally.add(b);
|
ally.add(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ally.clearTime();
|
||||||
|
|
||||||
Buff.prolong(hero, StasisBuff.class, 20 + 20*hero.pointsInTalent(Talent.STASIS)).stasisAlly = (Mob)ally;
|
Buff.prolong(hero, StasisBuff.class, 20 + 20*hero.pointsInTalent(Talent.STASIS)).stasisAlly = (Mob)ally;
|
||||||
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
||||||
@@ -112,7 +112,7 @@ public class Stasis extends ClericSpell {
|
|||||||
hero.buff(LifeLink.class).detach();
|
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);
|
hero.spendAndNext(Actor.TICK);
|
||||||
Dungeon.observe();
|
Dungeon.observe();
|
||||||
@@ -162,13 +162,16 @@ public class Stasis extends ClericSpell {
|
|||||||
spawnPoints.add(target.pos + PathFinder.NEIGHBOURS8[Random.Int(8)]);
|
spawnPoints.add(target.pos + PathFinder.NEIGHBOURS8[Random.Int(8)]);
|
||||||
}
|
}
|
||||||
stasisAlly.pos = Random.element(spawnPoints);
|
stasisAlly.pos = Random.element(spawnPoints);
|
||||||
stasisAlly.clearTime();
|
|
||||||
GameScene.add(stasisAlly);
|
GameScene.add(stasisAlly);
|
||||||
|
|
||||||
if (stasisAlly instanceof DirectableAlly){
|
if (stasisAlly instanceof DirectableAlly){
|
||||||
((DirectableAlly) stasisAlly).clearDefensingPos();
|
((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);
|
ScrollOfTeleportation.appear(stasisAlly, stasisAlly.pos);
|
||||||
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user