v2.4.0: added some positive variant cursed wand fx for wondrous resin

This commit is contained in:
Evan Debenham
2024-05-08 14:33:07 -04:00
parent fae26b61ae
commit e0c6daa43b
3 changed files with 49 additions and 9 deletions

View File

@@ -1328,7 +1328,7 @@ items.trinkets.trapmechanism.name=trap mechanism
items.trinkets.trapmechanism.desc=The core mechanism of one of the dungeon's pitfall traps, carefully carved out of the floor so it can be carried. It seems to be magically tied to the dungeon itself, making terrain more hazardous for you and the dungeon's inhabitants.\n\nAt its current level this trinket will make _%d%%_ of regular floors become filled with either traps or chasms instead.
items.trinkets.wondrousresin.name=wondrous resin
items.trinkets.wondrousresin.desc=This shimmering blue resin appears to have the distilled essence of a cursed wand's magic. The magic from the alchemy post has seemed to stabilize it somewhat, and its now affecting your wands.\n\nAt its current level this trinket will cause cursed wand effects to be forced positive _%1$s%%_ of the time, and will cause uncursed wands to fire an additional cursed zap _%2$s%%_ of the time.\n\nThis trinket costs a moderately large amount of energy to upgrade.
items.trinkets.wondrousresin.desc=This shimmering blue resin appears to have the distilled essence of a cursed wand's magic. The magic from the alchemy post has seemed to stabilize it somewhat, and its now affecting your wands.\n\nAt its current level this trinket will force cursed wand effects to become neutral or positive _%1$s%%_ of the time, and will cause uncursed wands to fire an additional cursed zap _%2$s%%_ of the time.\n\nThis trinket costs a moderately large amount of energy to upgrade.
items.trinkets.trinketcatalyst.name=magical catalyst
items.trinkets.trinketcatalyst.window_text=The water begins to glow as you add the catalyst. There are a few nearby items you could imbue with energy to turn into a magical trinket.

View File

@@ -69,8 +69,10 @@ public class ScrollOfMetamorphosis extends ExoticScroll {
}
public static void onMetamorph( Talent oldTalent, Talent newTalent ){
((ScrollOfMetamorphosis) curItem).readAnimation();
Sample.INSTANCE.play( Assets.Sounds.READ );
if (curItem instanceof ScrollOfMetamorphosis) {
((ScrollOfMetamorphosis) curItem).readAnimation();
Sample.INSTANCE.play(Assets.Sounds.READ);
}
curUser.sprite.emitter().start(Speck.factory(Speck.CHANGE), 0.2f, 10);
Transmuting.show(curUser, oldTalent, newTalent);
@@ -270,7 +272,11 @@ public class ScrollOfMetamorphosis extends ExoticScroll {
@Override
public void onBackPressed() {
((ScrollOfMetamorphosis)curItem).confirmCancelation(this);
if (curItem instanceof ScrollOfMetamorphosis) {
((ScrollOfMetamorphosis) curItem).confirmCancelation(this);
} else {
super.onBackPressed();
}
}
}
}

View File

@@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
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.Hex;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.GoldenMimic;
@@ -52,8 +53,11 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfMetamorphosis;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfSirensSong;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.WondrousResin;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
@@ -128,6 +132,7 @@ public class CursedWand {
switch(Random.Int(4)){
//anti-entropy
//doesn't affect caster if positive only
case 0: default:
Char target = Actor.findChar(targetPos);
if (Random.Int(2) == 0) {
@@ -147,6 +152,7 @@ public class CursedWand {
return true;
//random teleportation
//can only teleport enemy if positive only
case 2:
if(!positiveOnly && Random.Int(2) == 0) {
if (user != null && !user.properties().contains(Char.Property.IMMOVABLE)) {
@@ -205,6 +211,7 @@ public class CursedWand {
return true;
//Health transfer
//can only harm enemy if positive only
case 1:
final Char target = Actor.findChar( targetPos );
if (target != null) {
@@ -253,6 +260,7 @@ public class CursedWand {
return true;
//shock and recharge
//no shock if positive only
case 3:
if (!positiveOnly) new ShockingTrap().set( user.pos ).activate();
Buff.prolong(user, Recharging.class, Recharging.DURATION);
@@ -265,7 +273,7 @@ public class CursedWand {
private static boolean rareEffect(final Item origin, final Char user, final int targetPos){
boolean positiveOnly = Random.Float() < WondrousResin.positiveCurseEffectChance();
switch(positiveOnly ? 0 : Random.Int(4)){
switch(Random.Int(4)){
//sheep transformation
case 0: default:
@@ -291,7 +299,14 @@ public class CursedWand {
return true;
//curses!
//or hexes target if positive only
case 1:
if (positiveOnly){
ch = Actor.findChar( targetPos );
if (ch != null){
Buff.affect(ch, Hex.class, Hex.DURATION);
}
}
if (user instanceof Hero) {
CursingTrap.curse( (Hero) user );
} else {
@@ -300,8 +315,9 @@ public class CursedWand {
return true;
//inter-level teleportation
//of scroll of teleportation if positive only, or inter-floor teleport disallowed
case 2:
if (Dungeon.depth > 1 && Dungeon.interfloorTeleportAllowed() && user == Dungeon.hero) {
if (!positiveOnly && Dungeon.depth > 1 && Dungeon.interfloorTeleportAllowed() && user == Dungeon.hero) {
//each depth has 1 more weight than the previous depth.
float[] depths = new float[Dungeon.depth-1];
@@ -322,17 +338,23 @@ public class CursedWand {
return true;
//summon monsters
//or mirror images if positive only
case 3:
new SummoningTrap().set( targetPos ).activate();
if (positiveOnly && user == Dungeon.hero){
ScrollOfMirrorImage.spawnImages(Dungeon.hero, 2);
} else {
new SummoningTrap().set(targetPos).activate();
}
return true;
}
}
private static boolean veryRareEffect(final Item origin, final Char user, final int targetPos){
boolean positiveOnly = Random.Float() < WondrousResin.positiveCurseEffectChance();
switch( positiveOnly ? 0 : Random.Int(4) ){
switch( Random.Int(4) ){
//great forest fire!
//only grass, no fire, if positive only
case 0: default:
for (int i = 0; i < Dungeon.level.length(); i++){
GameScene.add( Blob.seed(i, 15, Regrowth.class));
@@ -350,6 +372,7 @@ public class CursedWand {
return true;
//golden mimic
//mimic is enthralled if positive only
case 1:
Char ch = Actor.findChar(targetPos);
@@ -383,9 +406,14 @@ public class CursedWand {
mimic.items.clear();
mimic.items.add(reward);
GameScene.add(mimic);
if (positiveOnly){
Buff.affect(mimic, ScrollOfSirensSong.Enthralled.class);
}
return true;
//crashes the game, yes, really.
//appears to crash the game (actually just closes it)
case 2:
try {
@@ -429,7 +457,13 @@ public class CursedWand {
}
//random transmogrification
//or triggers metamorph effect if positive only
case 3:
if (positiveOnly){
GameScene.show(new ScrollOfMetamorphosis.WndMetamorphChoose());
return true;
}
//skips this effect if there is no item to transmogrify
if (origin == null || user != Dungeon.hero || !Dungeon.hero.belongings.contains(origin)){
return cursedEffect(origin, user, targetPos);