v0.9.3: cursed wands can now proc on-zap effects like soul mark

This commit is contained in:
Evan Debenham 2021-05-26 17:40:18 -04:00
parent a4b83fbe11
commit 6b6f69ab17
15 changed files with 35 additions and 21 deletions

View File

@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.mage.WarpBeacon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GoldenMimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GoldenMimic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Sheep;
@ -81,7 +82,7 @@ import java.util.ArrayList;
public class CursedWand { public class CursedWand {
private static float COMMON_CHANCE = 0.6f; private static float COMMON_CHANCE = 0.6f;
private static float UNCOMMON_CHANCE = 10.3f; private static float UNCOMMON_CHANCE = 0.3f;
private static float RARE_CHANCE = 0.09f; private static float RARE_CHANCE = 0.09f;
private static float VERY_RARE_CHANCE = 0.01f; private static float VERY_RARE_CHANCE = 0.01f;
@ -97,6 +98,12 @@ public class CursedWand {
}); });
} }
public static void tryForWandProc( Char target, Item origin ){
if (target != null && origin instanceof Wand){
Wand.wandProc(target, origin.buffedLvl(), 1);
}
}
public static boolean cursedEffect(final Item origin, final Char user, final Char target){ public static boolean cursedEffect(final Item origin, final Char user, final Char target){
return cursedEffect(origin, user, target.pos); return cursedEffect(origin, user, target.pos);
} }
@ -127,11 +134,13 @@ public class CursedWand {
Buff.affect(user, Burning.class).reignite(user); Buff.affect(user, Burning.class).reignite(user);
if (target != null) Buff.affect(target, Frost.class, Frost.DURATION); if (target != null) Buff.affect(target, Frost.class, Frost.DURATION);
} }
tryForWandProc(target, origin);
return true; return true;
//spawns some regrowth //spawns some regrowth
case 1: case 1:
GameScene.add( Blob.seed(targetPos, 30, Regrowth.class)); GameScene.add( Blob.seed(targetPos, 30, Regrowth.class));
tryForWandProc(Actor.findChar(targetPos), origin);
return true; return true;
//random teleportation //random teleportation
@ -146,6 +155,7 @@ public class CursedWand {
Char ch = Actor.findChar( targetPos ); Char ch = Actor.findChar( targetPos );
if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) { if (ch != null && !ch.properties().contains(Char.Property.IMMOVABLE)) {
ScrollOfTeleportation.teleportChar(ch); ScrollOfTeleportation.teleportChar(ch);
tryForWandProc(ch, origin);
} else { } else {
return cursedEffect(origin, user, targetPos); return cursedEffect(origin, user, targetPos);
} }
@ -155,6 +165,7 @@ public class CursedWand {
//random gas at location //random gas at location
case 3: case 3:
Sample.INSTANCE.play( Assets.Sounds.GAS ); Sample.INSTANCE.play( Assets.Sounds.GAS );
tryForWandProc(Actor.findChar(targetPos), origin);
switch (Random.Int(3)) { switch (Random.Int(3)) {
case 0: default: case 0: default:
GameScene.add( Blob.seed( targetPos, 800, ConfusionGas.class ) ); GameScene.add( Blob.seed( targetPos, 800, ConfusionGas.class ) );
@ -182,6 +193,7 @@ public class CursedWand {
&& Dungeon.level.traps.get(pos) == null && Dungeon.level.traps.get(pos) == null
&& !Dungeon.isChallenged(Challenges.NO_HERBALISM)) { && !Dungeon.isChallenged(Challenges.NO_HERBALISM)) {
Dungeon.level.plant((Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED), pos); Dungeon.level.plant((Plant.Seed) Generator.randomUsingDefaults(Generator.Category.SEED), pos);
tryForWandProc(Actor.findChar(pos), origin);
} else { } else {
return cursedEffect(origin, user, targetPos); return cursedEffect(origin, user, targetPos);
} }
@ -220,6 +232,7 @@ public class CursedWand {
} else { } else {
Sample.INSTANCE.play(Assets.Sounds.BURNING); Sample.INSTANCE.play(Assets.Sounds.BURNING);
} }
tryForWandProc(target, origin);
} else { } else {
return cursedEffect(origin, user, targetPos); return cursedEffect(origin, user, targetPos);
} }
@ -228,6 +241,7 @@ public class CursedWand {
//Bomb explosion //Bomb explosion
case 2: case 2:
new Bomb().explode(targetPos); new Bomb().explode(targetPos);
tryForWandProc(Actor.findChar(targetPos), origin);
return true; return true;
//shock and recharge //shock and recharge

View File

@ -175,12 +175,12 @@ public abstract class Wand extends Item {
charger.setScaleFactor( chargeScaleFactor ); charger.setScaleFactor( chargeScaleFactor );
} }
protected void processSoulMark(Char target, int chargesUsed){ protected void wandProc(Char target, int chargesUsed){
processSoulMark(target, buffedLvl(), chargesUsed); wandProc(target, buffedLvl(), chargesUsed);
} }
//TODO some naming issues here. Consider renaming this method and externalizing char awareness buff //TODO Consider externalizing char awareness buff
protected static void processSoulMark(Char target, int wandLevel, int chargesUsed){ protected static void wandProc(Char target, int wandLevel, int chargesUsed){
if (Dungeon.hero.hasTalent(Talent.ARCANE_VISION)) { if (Dungeon.hero.hasTalent(Talent.ARCANE_VISION)) {
int dur = 5 + 5*Dungeon.hero.pointsInTalent(Talent.ARCANE_VISION); int dur = 5 + 5*Dungeon.hero.pointsInTalent(Talent.ARCANE_VISION);
Buff.append(Dungeon.hero, TalismanOfForesight.CharAwareness.class, dur).charID = target.id(); Buff.append(Dungeon.hero, TalismanOfForesight.CharAwareness.class, dur).charID = target.id();

View File

@ -79,7 +79,7 @@ public class WandOfBlastWave extends DamageWand {
Char ch = Actor.findChar(bolt.collisionPos + i); Char ch = Actor.findChar(bolt.collisionPos + i);
if (ch != null){ if (ch != null){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
if (ch.alignment != Char.Alignment.ALLY) ch.damage(damageRoll(), this); if (ch.alignment != Char.Alignment.ALLY) ch.damage(damageRoll(), this);
if (ch.pos == bolt.collisionPos + i) { if (ch.pos == bolt.collisionPos + i) {
@ -94,7 +94,7 @@ public class WandOfBlastWave extends DamageWand {
//throws the char at the center of the blast //throws the char at the center of the blast
Char ch = Actor.findChar(bolt.collisionPos); Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null){ if (ch != null){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damageRoll(), this); ch.damage(damageRoll(), this);
if (bolt.path.size() > bolt.dist+1 && ch.pos == bolt.collisionPos) { if (bolt.path.size() > bolt.dist+1 && ch.pos == bolt.collisionPos) {

View File

@ -63,7 +63,7 @@ public class WandOfCorrosion extends Wand {
for (int i : PathFinder.NEIGHBOURS9) { for (int i : PathFinder.NEIGHBOURS9) {
Char ch = Actor.findChar(bolt.collisionPos + i); Char ch = Actor.findChar(bolt.collisionPos + i);
if (ch != null) { if (ch != null) {
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
} }
} }

View File

@ -173,7 +173,7 @@ public class WandOfCorruption extends Wand {
} }
} }
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.8f * Random.Float(0.87f, 1.15f) ); Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.8f * Random.Float(0.87f, 1.15f) );
} else { } else {

View File

@ -110,7 +110,7 @@ public class WandOfDisintegration extends DamageWand {
int lvl = level + (chars.size()-1) + terrainBonus; int lvl = level + (chars.size()-1) + terrainBonus;
for (Char ch : chars) { for (Char ch : chars) {
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage( damageRoll(lvl), this ); ch.damage( damageRoll(lvl), this );
ch.sprite.centerEmitter().burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) ); ch.sprite.centerEmitter().burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
ch.sprite.flash(); ch.sprite.flash();

View File

@ -114,7 +114,7 @@ public class WandOfFireblast extends DamageWand {
} }
for ( Char ch : affectedChars ){ for ( Char ch : affectedChars ){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damageRoll(), this); ch.damage(damageRoll(), this);
if (ch.isAlive()) { if (ch.isAlive()) {
Buff.affect(ch, Burning.class).reignite(ch); Buff.affect(ch, Burning.class).reignite(ch);

View File

@ -77,7 +77,7 @@ public class WandOfFrost extends DamageWand {
ch.sprite.burst( 0xFF99CCFF, buffedLvl() / 2 + 2 ); ch.sprite.burst( 0xFF99CCFF, buffedLvl() / 2 + 2 );
} }
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damage, this); ch.damage(damage, this);
Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 1.1f * Random.Float(0.87f, 1.15f) ); Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 1.1f * Random.Float(0.87f, 1.15f) );

View File

@ -78,7 +78,7 @@ public class WandOfLightning extends DamageWand {
if (ch != curUser && ch.alignment == curUser.alignment && ch.pos != bolt.collisionPos){ if (ch != curUser && ch.alignment == curUser.alignment && ch.pos != bolt.collisionPos){
continue; continue;
} }
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
if (ch == curUser) { if (ch == curUser) {
ch.damage(Math.round(damageRoll() * multipler * 0.5f), this); ch.damage(Math.round(damageRoll() * multipler * 0.5f), this);
} else { } else {

View File

@ -93,7 +93,7 @@ public class WandOfLivingEarth extends DamageWand {
if (guardian != null && guardian == ch){ if (guardian != null && guardian == ch){
guardian.sprite.centerEmitter().burst(MagicMissile.EarthParticle.ATTRACT, 8 + buffedLvl() / 2); guardian.sprite.centerEmitter().burst(MagicMissile.EarthParticle.ATTRACT, 8 + buffedLvl() / 2);
guardian.setInfo(curUser, buffedLvl(), armorToAdd); guardian.setInfo(curUser, buffedLvl(), armorToAdd);
processSoulMark(guardian, chargesPerCast()); wandProc(guardian, chargesPerCast());
Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.9f * Random.Float(0.87f, 1.15f) ); Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.9f * Random.Float(0.87f, 1.15f) );
//shooting the guardian at a location //shooting the guardian at a location
@ -109,7 +109,7 @@ public class WandOfLivingEarth extends DamageWand {
ch.sprite.centerEmitter().burst(MagicMissile.EarthParticle.BURST, 5 + buffedLvl()/2); ch.sprite.centerEmitter().burst(MagicMissile.EarthParticle.BURST, 5 + buffedLvl()/2);
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damage, this); ch.damage(damage, this);
int closest = -1; int closest = -1;
@ -153,7 +153,7 @@ public class WandOfLivingEarth extends DamageWand {
ch.sprite.centerEmitter().burst(MagicMissile.EarthParticle.BURST, 5 + buffedLvl() / 2); ch.sprite.centerEmitter().burst(MagicMissile.EarthParticle.BURST, 5 + buffedLvl() / 2);
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damage, this); ch.damage(damage, this);
Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.8f * Random.Float(0.87f, 1.15f) ); Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, 0.8f * Random.Float(0.87f, 1.15f) );

View File

@ -58,7 +58,7 @@ public class WandOfMagicMissile extends DamageWand {
Char ch = Actor.findChar( bolt.collisionPos ); Char ch = Actor.findChar( bolt.collisionPos );
if (ch != null) { if (ch != null) {
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
ch.damage(damageRoll(), this); ch.damage(damageRoll(), this);
Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, Random.Float(0.87f, 1.15f) ); Sample.INSTANCE.play( Assets.Sounds.HIT_MAGIC, 1, Random.Float(0.87f, 1.15f) );

View File

@ -78,7 +78,7 @@ public class WandOfPrismaticLight extends DamageWand {
Char ch = Actor.findChar(beam.collisionPos); Char ch = Actor.findChar(beam.collisionPos);
if (ch != null){ if (ch != null){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
affectTarget(ch); affectTarget(ch);
} }
} }

View File

@ -113,7 +113,7 @@ public class WandOfRegrowth extends Wand {
} }
Char ch = Actor.findChar(cell); Char ch = Actor.findChar(cell);
if (ch != null){ if (ch != null){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
Buff.prolong( ch, Roots.class, 4f * chrgUsed ); Buff.prolong( ch, Roots.class, 4f * chrgUsed );
} }
} }

View File

@ -69,7 +69,7 @@ public class WandOfTransfusion extends Wand {
if (ch instanceof Mob){ if (ch instanceof Mob){
processSoulMark(ch, chargesPerCast()); wandProc(ch, chargesPerCast());
//this wand does different things depending on the target. //this wand does different things depending on the target.

View File

@ -302,7 +302,7 @@ public class WandOfWarding extends Wand {
int dmg = Random.NormalIntRange( 2 + wandLevel, 8 + 4*wandLevel ); int dmg = Random.NormalIntRange( 2 + wandLevel, 8 + 4*wandLevel );
enemy.damage( dmg, this ); enemy.damage( dmg, this );
if (enemy.isAlive()){ if (enemy.isAlive()){
Wand.processSoulMark(enemy, wandLevel, 1); Wand.wandProc(enemy, wandLevel, 1);
} }
if (!enemy.isAlive() && enemy == Dungeon.hero) { if (!enemy.isAlive() && enemy == Dungeon.hero) {