v2.5.0: added a final new very rare cursed wand effect: gravity chaos!
This commit is contained in:
@@ -1405,6 +1405,9 @@ items.wands.cursedwand.supernova=A blazing ball of energy starts to grow. You mi
|
||||
items.wands.cursedwand.supernova_positive=A blazing ball of energy starts to grow, but it feels safe somehow.
|
||||
items.wands.cursedwand.sinkhole=The ground starts to give way around you!
|
||||
items.wands.cursedwand.sinkhole_positive=The ground starts to give way, but feels solid enough beneath you.
|
||||
items.wands.cursedwand.gravity=Gravity suddenly starts to pull in random directions!
|
||||
items.wands.cursedwand.gravity_positive=Gravity suddenly starts to pull in random directions, but this doesn't seem to affect you.
|
||||
items.wands.cursedwand.gravity_end=The gravity chaos ends.
|
||||
|
||||
items.wands.damagewand.upgrade_stat_name_1=Magic Damage
|
||||
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2024 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.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.CursedWand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GravityChaosTracker extends Buff {
|
||||
|
||||
{
|
||||
actPriority = BUFF_PRIO-10; //acts after other buffs
|
||||
}
|
||||
|
||||
//lasts an average of 100 turns, with high variance
|
||||
public int left = Random.NormalIntRange(30, 70);
|
||||
|
||||
public boolean positiveOnly;
|
||||
|
||||
int idx;
|
||||
//used when tracking characters blocked by other characters
|
||||
ArrayList<Char> blocked = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
|
||||
//wait until all sprites have finished moving
|
||||
for (Char ch : Actor.chars()){
|
||||
try {
|
||||
synchronized (ch.sprite) {
|
||||
if (ch.sprite.isMoving) {
|
||||
ch.sprite.wait();
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!blocked.isEmpty()){
|
||||
boolean blockedremoved = false;
|
||||
for (Char ch : blocked.toArray(new Char[0])){
|
||||
Ballistica path = new Ballistica(ch.pos, ch.pos + PathFinder.NEIGHBOURS8[idx], Ballistica.MAGIC_BOLT);
|
||||
if (!(path.dist == 1 && Actor.findChar(path.collisionPos) != null)){
|
||||
if (ch instanceof Hero) ((Hero) ch).interrupt();
|
||||
WandOfBlastWave.throwChar(ch, path, 3, false, false, this);
|
||||
blocked.remove(ch);
|
||||
blockedremoved = true;
|
||||
}
|
||||
}
|
||||
if (!blockedremoved || blocked.isEmpty()){
|
||||
blocked.clear();
|
||||
left--;
|
||||
if (left <= 0){
|
||||
GLog.w(Messages.get(CursedWand.class, "gravity_end"));
|
||||
Sample.INSTANCE.play(Assets.Sounds.DEGRADE);
|
||||
detach();
|
||||
} else {
|
||||
spend(Random.IntRange(1, 3));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
idx = Random.Int(PathFinder.NEIGHBOURS8.length);
|
||||
for (Char ch : Actor.chars()){
|
||||
if (Char.hasProp(ch, Char.Property.IMMOVABLE) ||
|
||||
(positiveOnly && ch.alignment == Char.Alignment.ALLY)){
|
||||
continue;
|
||||
} else {
|
||||
if (ch instanceof Mob && ((Mob) ch).state == ((Mob) ch).SLEEPING){
|
||||
((Mob) ch).state = ((Mob) ch).WANDERING;
|
||||
}
|
||||
Ballistica path = new Ballistica(ch.pos, ch.pos + PathFinder.NEIGHBOURS8[idx], Ballistica.MAGIC_BOLT);
|
||||
if (path.dist == 1 && Actor.findChar(path.collisionPos) != null){
|
||||
blocked.add(ch);
|
||||
} else {
|
||||
if (ch instanceof Hero) ((Hero) ch).interrupt();
|
||||
WandOfBlastWave.throwChar(ch, path, 3, false, false, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if anything was blocked, we don't spend here and re-act
|
||||
// so we can try to re-push chars blocked by other chars
|
||||
if (blocked.isEmpty()){
|
||||
left--;
|
||||
if (left <= 0){
|
||||
GLog.w(Messages.get(CursedWand.class, "gravity_end"));
|
||||
Sample.INSTANCE.play(Assets.Sounds.DEGRADE);
|
||||
detach();
|
||||
} else {
|
||||
spend(Random.IntRange(1, 3));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
@Override
|
||||
public void storeInBundle(Bundle bundle) {
|
||||
super.storeInBundle(bundle);
|
||||
bundle.put(LEFT, left);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFromBundle(Bundle bundle) {
|
||||
super.restoreFromBundle(bundle);
|
||||
left = bundle.getInt(LEFT);
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class Warlock extends Mob implements Callback {
|
||||
//TODO would be nice for this to work on ghost/statues too
|
||||
if (enemy == Dungeon.hero && Random.Int( 2 ) == 0) {
|
||||
Buff.prolong( enemy, Degrade.class, Degrade.DURATION );
|
||||
Sample.INSTANCE.play( Assets.Sounds.DEBUFF );
|
||||
Sample.INSTANCE.play( Assets.Sounds.DEGRADE );
|
||||
}
|
||||
|
||||
int dmg = Random.NormalIntRange( 12, 18 );
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GravityChaosTracker;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HeroDisguise;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invulnerability;
|
||||
@@ -119,7 +120,7 @@ public class CursedWand {
|
||||
public static void cursedZap(final Item origin, final Char user, final Ballistica bolt, final Callback afterZap){
|
||||
|
||||
boolean positiveOnly = user == Dungeon.hero && Random.Float() < WondrousResin.positiveCurseEffectChance();
|
||||
CursedEffect effect = randomValidEffect(origin, user, bolt, positiveOnly);
|
||||
CursedEffect effect = new GravityChaos();
|
||||
|
||||
effect.FX(origin, user, bolt, new Callback() {
|
||||
@Override
|
||||
@@ -1263,4 +1264,24 @@ public class CursedWand {
|
||||
}
|
||||
}
|
||||
|
||||
public static class GravityChaos extends CursedEffect{
|
||||
|
||||
@Override
|
||||
public void FX(Item origin, Char user, Ballistica bolt, Callback callback) {
|
||||
callback.call(); //no vfx
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean effect(Item origin, Char user, Ballistica bolt, boolean positiveOnly) {
|
||||
Buff.append(user, GravityChaosTracker.class).positiveOnly = positiveOnly;
|
||||
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
||||
if (positiveOnly){
|
||||
GLog.p(Messages.get(CursedWand.class, "gravity_positive"));
|
||||
} else {
|
||||
GLog.w(Messages.get(CursedWand.class, "gravity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user