From 348f16c19b07ccfadbc48b92ccfacef0fa1b78a6 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 30 Mar 2015 02:08:57 -0400 Subject: [PATCH] v0.3.0: reworked scroll of recharging & battlemage charging mechanics --- assets/buffs.png | Bin 3643 -> 3653 bytes assets/large_buffs.png | Bin 4587 -> 4605 bytes .../actors/hero/Hero.java | 18 ++----- .../items/scrolls/ScrollOfRecharging.java | 47 ++++++++++++++---- .../items/wands/Wand.java | 12 ++++- .../ui/BuffIndicator.java | 1 + 6 files changed, 52 insertions(+), 26 deletions(-) diff --git a/assets/buffs.png b/assets/buffs.png index f2f365c74bd409421a37f1cbb5c47b1fc16a3b2b..575cfe8c436138fba1337e7e766e866cc029940b 100644 GIT binary patch delta 738 zcmV<80v-Lk9K{^4X$q5(3i1U2hy@);lV%DYf8PTg6*vset6+lw00N~+L_t(Y$HkLt zSK43@gx6xliWYBN)Ph1#>!pAsDntx-ko^B2OjFU}_B92MqyC$rKp9hrK) z-Uzp2nwfl4%QP^3HA$>63`KTKUrZ^}xhXX5nr=<_P@^**k2?go4nqLUdkV0(w+Dbz ze|+=l%zx_Mbf5gz10D~p!4-aar2y;e00@FI{m(D}7!HR7D3wYIkd6T|1jrL$YjbmR zYYCt;Zgd*s&e0M6s0qvwfuo0VW`gs}%$mjL8pz-WZaY2`CX;c`X3OjRr6J6JRu-gTN6Rkr{6Pe}?i~`XGQ@DS!wP2w)#1ub={e3SU8quOLmO zc>D}sK|YTNaQi|pOp@j4Y00T%~!S5a5J7^{ys8VqUV9y$?bl@Xf5CQz>7PzuxxBv)0S)UH@3MRHX U<5p+B8vp delta 728 zcmV;}0w?{&9J?H_X$q5L3mXdF3K0Vm3#*mrrjuq0^?ynp47J7p00NsyL_t(YOU09G zSK43@gx6xl3KnnNw4e~wdZ{3Z3K7FyB>(>hb!ImS7O6eRrkTk%wM|3QXOqMV!%$?~^vRSmoti?^j_KNj4>h}!$)rnw%P<7MysrSeySo55 z#y20&{C~&ZRqxSn-{W=P9$w&=7YeYx4uBx2vi}JR0He`}0F_Eb0n#x*h5!WuY;A6C zZoLBNPMY23q+2fIkLti27C1VTGZV}&Grxzrwt$j zfPxnK^H~5)noU0JPk`}!4gyE4L}obt73H_}MSlRfPyi7)5TJdKTtN*0HC{o5SCFPs z96!S=C=_4;=HJ1&7Ohtf;0rDzfM+_e_l^TYbpT!UM_?Hc0*t7{fd~NOGXuYIAkM%K z8jv`E_OkbW2DB|4s0uS6Cnx~aPz0a_sSWhsNS$Wl5U$L?@)nH8%z(3p`p_1zKLE5A zTYr%L^A<$uAsfF0MHaI15ByT zn)edEcx#U5@JTha9=5g6{}u$2cU?Cxxqp5R1i987)#CVv*%+W$JU>4#7SUT)0z?j+ zQEve79{_N^s{=8BIdDtu4+bu35CPnkN_?z80P1xRpud11gaxavK({E6*Z~qS1MHtT z!1)P4F$3GofB`HV$mQrjsa2u_huK#E=77!r#sX0bstbU|frW6YA+!uI1Rg@j{yhMo z0m&8ongQNHE6G5eiZg)T?g|S&v;`5sUv7c>HUQxYOa8U~JHSr{WkNfRnsS{00000< KMNUMnLSTaQ>Od+0 diff --git a/assets/large_buffs.png b/assets/large_buffs.png index 2803b6c64254eba2c268c32bdbb36a5c1cc8fe02..624f5f7c4931737311ba027b77fcce7479250c07 100644 GIT binary patch delta 1694 zcmXYxYdn;R9>@RB%rloYhMB>#gfS$^>LJ^4iy60!qaj&+RMtqRC^9x%v&cLyxs`)r z+t&KTL6dYD-H2jzv6n1P(Wa56w3)V9xi1s*oL-#YtM8ldyYJ`s&VI#Sk!*0P(qMrC z#T4t%Q+o|;WG~3pW}dXzZ*MUGsIkHzLA3PQUq3LnTW&Tj9NAydIOJ6QiiQXt1(k)A zhM0PA)_ov|tw$z*>Z|R%rm$3Hjvh7cpR_sjwe;+*c>Cxs=hSu2o#w0bF�wf4=Q} zWYv^Z@}xSZDyG_~YIjqZ9~{yxodtDP9Egn_kc$)<488k?I+&t^9EUK(Q1nM<-kD5S$cPzGn(W+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e%SFnn>WVkrI%lJu}F!#O#o#r;d zhX$<(WPlHwYB;AO5lea0F`!?gz6~|rv^isHRuf{+HbKiSI&zN8$*wY_WmBN1I)&U@ zofI`XGlU77M?24K9{qB^e^1&(ZyI6jK8hJtf`6-|Fla<}`+%c3%*;GF+y z8ywbuMzVu>V!f6mD$$gA8KTlK;-gG`@}iG`xZo-vsnh0$pjcU=h`R1F$>0h$#Ce9o zuf_f!PJyKdolrcZi^q^@3cQbY7Z3}-y*uI12+dA6vIxg);)GuPWaah^N-Ccyt`@>3 zoHjo{FJ^(q6Q|vup)^t(&q&3(lfc$4H#g_Z?Y+c{sGX3lO%?%>xLb*lTdTxPtXDI> z`D#w8HDOCdjxIs6G7NI7MxBm8$8SNl#AIFFL;HFc2sfiC3$=&?NE=Q~CB3Y(g1+Qb^idXQ4vkvhiVug_FbNO*Z zzk3?@_h%M_;|rR<_R&H#))ZAXroqX9KdPK{W|M2~ph`?$c@QhJ=3%#d3FHnz?!y~W z`N=Wb1%7MheY9c--hGig&NG*{jOH(mJwS*6KZFrwkw3 zLcEVX8*b=iWbP6brwz8D3ExVu jLR0@A57+)*CYJ3=d(Hl-)%#fT$9uq2a?thWXHxm^)JoEq diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 099ddd966..550b4dab1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -86,6 +86,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; @@ -102,7 +103,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; -import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage; import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect; @@ -872,18 +872,10 @@ public class Hero extends Char { } break; case BATTLEMAGE: - if (wep instanceof Wand) { - Wand wand = (Wand)wep; - if (wand.curCharges < wand.maxCharges && damage > 0) { - - wand.curCharges++; - if (Dungeon.quickslot.contains(wand)) { - QuickSlotButton.refresh(); - } - - ScrollOfRecharging.charge( this ); - } - damage += wand.curCharges; + if (wep instanceof Wand || wep instanceof MagesStaff) { + //gives wands 50% charge + Buff.affect( this, ScrollOfRecharging.Recharging.class, 2f); + ScrollOfRecharging.charge( this ); } break; case SNIPER: diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java index 77afedb4d..570e6216b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java @@ -17,6 +17,9 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; @@ -27,6 +30,8 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; public class ScrollOfRecharging extends Scroll { + public static final float BUFF_DURATION = 30f; + { name = "Scroll of Recharging"; initials = "Re"; @@ -34,19 +39,15 @@ public class ScrollOfRecharging extends Scroll { @Override protected void doRead() { - - int count = curUser.belongings.charge( true ); - charge( curUser ); + + Buff.affect(curUser, Recharging.class, BUFF_DURATION); + charge(curUser); Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); - - if (count > 0) { - GLog.i( "a surge of energy courses through your pack, recharging your wand" + (count > 1 ? "s" : "") ); - SpellSprite.show( curUser, SpellSprite.CHARGE ); - } else { - GLog.i( "a surge of energy courses through your pack, but nothing happens" ); - } + + GLog.i( "a surge of energy courses through your body, invigorating your wands."); + SpellSprite.show( curUser, SpellSprite.CHARGE ); setKnown(); curUser.spendAndNext( TIME_TO_READ ); @@ -56,7 +57,7 @@ public class ScrollOfRecharging extends Scroll { public String desc() { return "The raw magical power bound up in this parchment will, when released, " + - "recharge all of the reader's wands to full power."; + "charge up all the users wands over time."; } public static void charge( Hero hero ) { @@ -67,4 +68,28 @@ public class ScrollOfRecharging extends Scroll { public int price() { return isKnown() ? 40 * quantity : super.price(); } + + + public static class Recharging extends FlavourBuff { + + @Override + public int icon() { + return BuffIndicator.CHARGE; + } + + @Override + public String toString() { + return "Recharging"; + } + + //want to process partial turns for this buff, and not count it when it's expiring. + //firstly, if this buff has half a turn left, should give out half the benefit. + //secondly, recall that buffs execute in random order, so this can cause a problem where we can't simply check + //if this buff is still attached, must instead directly check its remaining time, and act accordingly. + //otherwise this causes inconsistent behaviour where this may detach before, or after, a wand charger acts. + public float remainder() { + return Math.min( 1f, this.cooldown()); + } + + } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 46de4cb82..60ed89387 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import java.util.ArrayList; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -61,7 +62,7 @@ public abstract class Wand extends KindOfWeapon { public int maxCharges = initialCharges(); public int curCharges = maxCharges; - private float partialCharge = 0f; + protected float partialCharge = 0f; protected Charger charger; @@ -123,7 +124,7 @@ public abstract class Wand extends KindOfWeapon { } protected abstract void onZap( Ballistica attack ); - + @Override public boolean collect( Bag container ) { if (super.collect( container )) { @@ -395,6 +396,8 @@ public abstract class Wand extends KindOfWeapon { private static final float SCALING_CHARGE_ADDITION = 40f; private static final float NORMAL_SCALE_FACTOR = 0.85f; + private static final float CHARGE_BUFF_BONUS = 0.25f; + float scalingFactor = NORMAL_SCALE_FACTOR; @Override @@ -427,6 +430,11 @@ public abstract class Wand extends KindOfWeapon { + (SCALING_CHARGE_ADDITION * Math.pow(scalingFactor, missingCharges))); partialCharge += 1f/turnsToCharge; + + ScrollOfRecharging.Recharging bonus = target.buff(ScrollOfRecharging.Recharging.class); + if (bonus != null && bonus.remainder() > 0f){ + partialCharge += CHARGE_BUFF_BONUS * bonus.remainder(); + } } private void setScaleFactor(float value){ diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java index dcc947e08..9ecce0be9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -67,6 +67,7 @@ public class BuffIndicator extends Component { public static final int THORNS = 31; public static final int FORESIGHT = 32; public static final int VERTIGO = 33; + public static final int CHARGE = 34; public static final int SIZE = 7;