From 38874247563f355cfb768e8f2bb4d7b1ec3ac1cb Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 13 Aug 2024 14:55:20 -0400 Subject: [PATCH] v2.5.0: added a new very rare cursed wand effect: shapeshift! --- core/src/main/assets/interfaces/buffs.png | Bin 1669 -> 1700 bytes .../main/assets/interfaces/large_buffs.png | Bin 3681 -> 3741 bytes .../assets/messages/actors/actors.properties | 3 + .../assets/messages/items/items.properties | 1 + .../actors/buffs/HeroDisguise.java | 84 ++++++++++++++++++ .../items/wands/CursedWand.java | 25 +++++- .../scenes/GameScene.java | 10 ++- .../sprites/HeroSprite.java | 14 +++ .../ui/BuffIndicator.java | 1 + .../shatteredpixeldungeon/ui/StatusPane.java | 8 +- .../windows/WndHero.java | 2 +- 11 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HeroDisguise.java diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index fab8b983d94d13a70d6192c4199d8d4fa046d1c1..980748a79359e758af48f268f16874646d6ad6fb 100644 GIT binary patch delta 1353 zcmV-P1-ANy4Wtc_BmpL|B@6)~%($cfe*meesepffEdl~FGc#{@N11wDydxubcXt<= z@$HjJ0U#J0Nkl*Q?@Alo3(2T5^P2a}0y8ti|Nj%|p3csxe9Yfy zlH>li=go=&{!0*WM+0TVm*WxiK%j?5(2k9K0D;c#P98y57b?K>|BU^Mb2T+UfnWX? z=w$=xTN*HI<~#nQc$Y5<07V0ZKxb!nlDw&bI0Kx2fY^Yg4u!YRfD<&(>a7k^EC}>q zQGgYc`jFoTfdss1241-ZEiIe@&eVt90_0Nw3j#tz_^w;vqF)S%K`|tTMM;c^QQ_`m z*yAD-6Jk>QAPo4Fxp*niS|+UspQgYJ85o?M8=RYkK%VCic#-EXATSfw$TLEL`5>?` zwg7>DMckjoD6m8*uuOrK)z#INAEun~CLjO{34|$nDlkU|hw`db^P%B!NXXV0ax3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2E=SF?~$TDDWQf+Ym7GD6qiOX?!m5X4ozZARQa|)#`_;8-LcGr-lqG1mM&U0)1>n z(=mK@ouAFXU>gmDv!4hwP(WE=s3SoBL?9nKfMYi$jR~IAQ~<%&($q-lK5VF)W|!Nw8rF<%8J34W7W10LS1r8u(JTV4+b1g}{%$ zwmZiH00000gZ!;VA*0RaI40Re#kcWk6*xJ#^100000NkvXX Hu0mjf=L%n% diff --git a/core/src/main/assets/interfaces/large_buffs.png b/core/src/main/assets/interfaces/large_buffs.png index 87385dd1e786794a0875893230129797a902c19d..2ac695a7d2192e26791e26b8a04efa80519f77ac 100644 GIT binary patch delta 3396 zcmX9>c{G%Z8~(m;W|)NxvNkaoOCwB?waiD6v>=pAnbE$8xv4~&@0+2xl}zQ9HcP9b zD2f#GMG0BPZ6Vb)F_w}wWhP_h=bqpD*ZZ9FocEmfJxqep&d$yklQ((Etdju%01vER7Ye}rojU+P+vVIEFa(jn)a4-z_u{AB>TH)E`e*Nh zGxq21h~3uT&t7`w{hQmnfBOZTUu6MJtagRSmQ3R+{8N%7?Q!>MqqC2 zM)=L+eP#UvG;)TuP5wt+kr@%FVOG}KHlubY%vKvnNh{Dp;V?lONZ7?DMr7VwX$0=e zsJ?X@QDtV#Ghn412HA;UM$i7~KsNwGZ$S@95bBuu%62mpq9{DaT_zMDJ0?Ah0XAw+ zEcM2Vjt><*anhz$I<*g#K%RyG&R*rTqfKt}a(=2)&J1N9z!sQ8qQzITmTK{N*&J<@ zgW4NPrTko<2dOyHvx~#_0#P%Cxp{kA z-JbRr&??UOg=CWrssb-xeUNmerLXD3)|*SLZU6D{P^%MTIiEZ(rRQoQWWU>g4(Il` zz=S;`&yUOxnAvKNw%vwSSYd9>0^&T{+0L_swNmTL35ACRfOng% zk7u4&trc9qvfBXZxsFQz0zwEYaQi4X&Pf^U*WB(R&9mY3b;6y7!I5Al*yiCUGRHLw z${?l%;!L{rny$Ex){uFmNxt6Fi?JpQ)@yoRn`0{BfVgXo&}sJ--T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3pX)I*_StW+dwpMM~NTSeL0_@-DRj9Q>1{K4ieG)5X7$yLB%B zPyY2H0Amp3J=Os7FVwE_dI>F+2Eyhm{54gTbEF&MZ$gM2x~Me>TMnxeaAXd-+!}}r zx#KBNKCoPq=VHW(?Iy+9nMU;?KCiHBz?Tab>SNXdDilCcT7xH(n=MZO*8mC-vM!it z0V_{xE!LHdmQD&`9j9LohK5+;JaiK_T}0dsP>jpP{O0#Kj;P*yTu=4OqW&8=`zffKE01erB3C|%xit_E!o!pYxv zO$&@kWR5x5uKJbSAOXI|5`T)d`KWg%i^%L=ywryry0qt) znQL_Y`)7bogi;7Nt0FeW#ds5P*1~Z;yQeZ~akx${*r~all87rrx%$Qdd{7?O{+u|m^p#vbr3&0zw@9I$-6e^!RwkN{i3p)g* zXY}K1t{hZX`h=I`qqH3BnhXHs&fQctNV|j}wh|9?tM69Ep^2001Ga+lb?;`Q+kFY; znq}G^fZ`r{0dXc^B~-NkaVWNEKeh;x`37QtynFH~?Ylm<+;TUlIB*_qpgL;!7fH`O z1!K{6=&^49n_ e|5g7@{~vJM$c_xZf3Dj8xAt`NajkR_rv3*VozIQ{ diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 30626c2b8..0b479eee3 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -229,6 +229,9 @@ actors.buffs.haste.desc=Energy courses through your muscles, allowing you to run actors.buffs.healing.name=healing actors.buffs.healing.desc=A magical remedy is causing wounds to close and flesh to knit.\n\nEvery turn health will steadily regenerate until the healing effect expires. The amount of healing may fade over time.\n\nNext heal: %d.\n\nHealing remaining: %d. +actors.buffs.herodisguise.name=disguise +actors.buffs.herodisguise.desc=Illusory magic has altered your physical appearance! The effect is purely cosmetic, but feels very strange regardless.\n\nTurns of disguise remaining: %s. + actors.buffs.hex.name=hexed actors.buffs.hex.heromsg=You have been hexed! actors.buffs.hex.desc=Dark magic which saps focus, making the target slightly disoriented.\n\nHexing reduces accuracy and evasion by 20%%, making the target less effective in combat.\n\nTurns of hex remaining: %s. diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index ddde55438..57598cf1b 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1396,6 +1396,7 @@ items.wands.cursedwand.grass=Grass erupts around you! items.wands.cursedwand.fire=You smell burning... items.wands.cursedwand.transmogrify_wand=Your wand transmogrifies into a different item! items.wands.cursedwand.transmogrify_other=Your item transmogrifies into something different! +items.wands.cursedwand.disguise=Your appearance changes before your eyes! items.wands.damagewand.upgrade_stat_name_1=Magic Damage diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HeroDisguise.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HeroDisguise.java new file mode 100644 index 000000000..e36329da6 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/HeroDisguise.java @@ -0,0 +1,84 @@ +/* + * 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 + */ + +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.utils.Bundle; +import com.watabou.utils.Random; + +public class HeroDisguise extends FlavourBuff { + + { + announced = true; + } + + private HeroClass cls = null; + + public static float DURATION = 1000f; + + public HeroClass getDisguise(){ + return cls; + } + + @Override + public int icon() { + return BuffIndicator.DISGUISE; + } + + @Override + public float iconFadePercent() { + return Math.max(0, (DURATION - visualcooldown()) / DURATION); + } + + @Override + public void fx(boolean on) { + if (target instanceof Hero && target.sprite instanceof HeroSprite){ + if (cls == null) { + do { + cls = Random.oneOf(HeroClass.values()); + } while (cls == ((Hero) target).heroClass); + } + + if (on) ((HeroSprite)target.sprite).disguise(cls); + else ((HeroSprite)target.sprite).disguise(((Hero) target).heroClass); + GameScene.updateAvatar(); + } + } + + private static final String CLASS = "class"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(CLASS, cls); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + cls = bundle.getEnum(CLASS, HeroClass.class); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 3463e2d62..255aeb2d3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -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.HeroDisguise; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -92,7 +93,6 @@ public class CursedWand { boolean positiveOnly = user == Dungeon.hero && Random.Float() < WondrousResin.positiveCurseEffectChance(); CursedEffect effect = randomValidEffect(origin, user, bolt, positiveOnly); - //CursedEffect effect = new InterFloorTeleport(); effect.FX(origin, user, bolt, new Callback() { @Override @@ -526,6 +526,7 @@ public class CursedWand { VERY_RARE_EFFECTS.add(new SpawnGoldenMimic()); VERY_RARE_EFFECTS.add(new AbortRetryFail()); VERY_RARE_EFFECTS.add(new RandomTransmogrify()); + VERY_RARE_EFFECTS.add(new HeroShapeShift()); } public static CursedEffect randomVeryRareEffect(){ @@ -699,4 +700,26 @@ public class CursedWand { } } + public static class HeroShapeShift extends CursedEffect{ + + @Override + public boolean valid(Item origin, Char user, Ballistica bolt, boolean positiveOnly) { + return user instanceof Hero || Actor.findChar(bolt.collisionPos) instanceof Hero; + } + + @Override + public boolean effect(Item origin, Char user, Ballistica bolt, boolean positiveOnly) { + if (user instanceof Hero){ + Buff.affect(user, HeroDisguise.class, HeroDisguise.DURATION); + GLog.w( Messages.get(CursedWand.class, "disguise") ); + return true; + } else if (Actor.findChar(bolt.collisionPos) instanceof Hero){ + Buff.affect(Actor.findChar(bolt.collisionPos), HeroDisguise.class, HeroDisguise.DURATION); + GLog.w( Messages.get(CursedWand.class, "disguise") ); + return true; + } + return false; + } + } + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 96d92b765..74b3cee5e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1179,11 +1179,15 @@ public class GameScene extends PixelScene { } public static void updateKeyDisplay(){ - if (scene != null) scene.menu.updateKeys(); + if (scene != null && scene.menu != null) scene.menu.updateKeys(); } public static void showlevelUpStars(){ - if (scene != null) scene.status.showStarParticles(); + if (scene != null && scene.status != null) scene.status.showStarParticles(); + } + + public static void updateAvatar(){ + if (scene != null && scene.status != null) scene.status.updateAvatar(); } public static void resetMap() { @@ -1613,7 +1617,7 @@ public class GameScene extends PixelScene { image = Icons.get(Icons.INFO); } else if (objects.get(0) instanceof Hero) { title = textLines.remove(0); - image = HeroSprite.avatar(((Hero) objects.get(0)).heroClass, ((Hero) objects.get(0)).tier()); + image = HeroSprite.avatar((Hero) objects.get(0)); } else if (objects.get(0) instanceof Mob) { title = textLines.remove(0); image = ((Mob) objects.get(0)).sprite(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java index ec714233a..bce52f5f5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/HeroSprite.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.HeroDisguise; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -61,6 +62,11 @@ public class HeroSprite extends CharSprite { else die(); } + + public void disguise(HeroClass cls){ + texture( cls.spritesheet() ); + updateArmor(); + } public void updateArmor() { @@ -167,6 +173,14 @@ public class HeroSprite extends CharSprite { return tiers; } + + public static Image avatar( Hero hero ){ + if (hero.buff(HeroDisguise.class) != null){ + return avatar(hero.buff(HeroDisguise.class).getDisguise(), hero.tier()); + } else { + return avatar(hero.heroClass, hero.tier()); + } + } public static Image avatar( HeroClass cl, int armorTier ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index 0a628e6c9..946409887 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -120,6 +120,7 @@ public class BuffIndicator extends Component { public static final int MONK_ENERGY = 68; public static final int DUEL_COMBO = 69; public static final int DAZE = 70; + public static final int DISGUISE = 71; public static final int SIZE_SMALL = 7; public static final int SIZE_LARGE = 16; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 9892ccc63..a170c38dc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -108,7 +108,7 @@ public class StatusPane extends Component { }; add(heroInfo); - avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier ); + avatar = HeroSprite.avatar( Dungeon.hero ); add( avatar ); talentBlink = 0; @@ -319,12 +319,16 @@ public class StatusPane extends Component { int tier = Dungeon.hero.tier(); if (tier != lastTier) { lastTier = tier; - avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) ); + avatar.copy( HeroSprite.avatar( Dungeon.hero ) ); } counter.setSweep((1f - Actor.now()%1f)%1f); } + public void updateAvatar(){ + avatar.copy( HeroSprite.avatar( Dungeon.hero ) ); + } + public void alpha( float value ){ value = GameMath.gate(0, value, 1f); bg.alpha(value); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java index c88de62cc..9179138d0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndHero.java @@ -142,7 +142,7 @@ public class WndHero extends WndTabbed { Hero hero = Dungeon.hero; IconTitle title = new IconTitle(); - title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) ); + title.icon( HeroSprite.avatar(hero) ); if (hero.name().equals(hero.className())) title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) ); else