From cedf68f4b001a909b1bbe257f4d6894bee527cf4 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 8 Mar 2019 01:19:51 -0500 Subject: [PATCH] v0.7.2: implemented swift enchantment and polarized curse also adjusted sniper's mark to last for a static 2 turns --- core/src/main/assets/buffs.png | Bin 1153 -> 1169 bytes core/src/main/assets/large_buffs.png | Bin 2312 -> 2362 bytes .../actors/hero/Hero.java | 10 ++- .../items/weapon/SpiritBow.java | 2 +- .../items/weapon/Weapon.java | 6 +- .../curses/{Shifting.java => Polarized.java} | 14 ++-- .../items/weapon/enchantments/Swift.java | 67 +++++++++++++++++- .../items/weapon/enchantments/Unstable.java | 4 +- .../items/weapon/missiles/MissileWeapon.java | 7 ++ .../ui/BuffIndicator.java | 1 + .../messages/items/items.properties | 9 +++ 11 files changed, 108 insertions(+), 12 deletions(-) rename core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/{Shifting.java => Polarized.java} (83%) diff --git a/core/src/main/assets/buffs.png b/core/src/main/assets/buffs.png index ab506f60f101c983ef92b77bf163317db19293a3..6bf21aa6fd3c5fee5c660abde96d525aa3f7f0bf 100644 GIT binary patch delta 880 zcmV-$1CRWH36Tk~F9Cl|Nkl*aaxBuU;ZkVX*%vOom#JcmF*L`7`M zs;)|78~ioawM5j4K-WQ_?+5OmBOox2BMVH^Bm(oNz`_D63v7S;zHi?G=t)d{8>ltKgFhz$$_MoZkY8C+SBj5M~(+ zBGMp=QKn{$l|L4sRs@JJfgbJquPrzsaPk&RDD(#qSP+=Nx?%)a{{!{>Pik3cw+%!= z^qgu-Q>HD4naqD|K@#)-e^6)qtTmN&R~t^=)o3;ev{n+3!25;3xf1ZdN#F^$=7TS6 zJj|B?5KABk==RBG0-GJUPyitT55WJv0}xDL7rP)HUIJ%a5_m3wOU}Qffad?Q1DmHH ziqrvh>Yq-53?#rM0TD|0`%?hp%D6UejFM3{UKkalY5;$zao3H8(KK4dBf}B29gL;G z?vB{y@Qwt!;`*l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 - /*Swift.class,*/ Elastic.class, Projecting.class, + Swift.class, Elastic.class, Projecting.class, Unstable.class, Precise.class, Blocking.class}; private static final Class[] rare = new Class[]{ @@ -318,7 +320,7 @@ abstract public class Weapon extends KindOfWeapon { private static final Class[] curses = new Class[]{ Annoying.class, Displacing.class, Exhausting.class, Fragile.class, - Sacrificial.class, Wayward.class, /*Shifting.class,*/ Friendly.class + Sacrificial.class, Wayward.class, Polarized.class, Friendly.class }; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Shifting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java similarity index 83% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Shifting.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java index 959cf8cc7..d21940697 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Shifting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java @@ -24,15 +24,21 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Random; -public class Shifting extends Weapon.Enchantment { +public class Polarized extends Weapon.Enchantment { private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); @Override - public int proc(Weapon weapon, Char attacker, Char defender, int damage) { - //TODO implement - return damage; + public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + + if (Random.Int(2) == 0){ + return Math.round(1.5f*damage); + } else { + return 0; + } + } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Swift.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Swift.java index 72f107fc3..2311d7291 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Swift.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Swift.java @@ -22,8 +22,16 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; +import com.watabou.noosa.Image; +import com.watabou.utils.Bundle; +import com.watabou.utils.Random; public class Swift extends Weapon.Enchantment { @@ -31,8 +39,14 @@ public class Swift extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage) { + // lvl 0 - 13% + // lvl 1 - 22% + // lvl 2 - 30% + int level = Math.max( 0, weapon.level() ); - + if (Random.Int( level + 8 ) >= 7) { + Buff.prolong(attacker, SwiftAttack.class, 2).setSourceType(weapon instanceof MeleeWeapon); + } return damage; } @@ -41,4 +55,55 @@ public class Swift extends Weapon.Enchantment { public ItemSprite.Glowing glowing() { return YELLOW; } + + public static class SwiftAttack extends FlavourBuff { + + boolean sourceWasMelee; + + public void setSourceType( boolean melee ){ + this.sourceWasMelee = melee; + } + + public boolean boostsMelee(){ + return !sourceWasMelee; + } + + public boolean boostsRanged(){ + return sourceWasMelee; + } + + @Override + public int icon() { + return BuffIndicator.WEAPON; + } + + @Override + public void tintIcon(Image icon) { + icon.hardlight(1, 1, 0); + } + + @Override + public String toString() { + return Messages.get(this, "name"); + } + + @Override + public String desc() { + return Messages.get(this, sourceWasMelee ? "desc_melee" : "desc_ranged", dispTurns()); + } + + private static final String WAS_MELEE = "was_melee"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + bundle.put(WAS_MELEE, sourceWasMelee); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + sourceWasMelee = bundle.getBoolean(WAS_MELEE); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java index a3a60b86c..759c44f3d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java @@ -39,10 +39,10 @@ public class Unstable extends Weapon.Enchantment { Elastic.class, Grim.class, Lucky.class, - //precise also not included here, is manually check in attackSkill + //precise also not included here, is manually checked in attackSkill //projecting not included, no on-hit effect Shocking.class, - //Swift.class, + Swift.class, Vampiric.class }; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 9b2de9709..796a51c93 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.MagicalHolster; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; @@ -194,6 +195,12 @@ abstract public class MissileWeapon extends Weapon { @Override public float castDelay(Char user, int dst) { + if (Actor.findChar( dst ) != null + && user.buff(Swift.SwiftAttack.class) != null + && user.buff(Swift.SwiftAttack.class).boostsRanged()) { + user.buff(Swift.SwiftAttack.class).detach(); + return 0; + } return speedFactor( user ); } 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 7cbcbfb41..c55e2f599 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/BuffIndicator.java @@ -90,6 +90,7 @@ public class BuffIndicator extends Component { public static final int PREPARATION = 42; public static final int WELL_FED = 43; public static final int HEALING = 44; + public static final int WEAPON = 45; public static final int SIZE = 7; diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 092d2b627..3153235d3 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -1152,6 +1152,9 @@ items.weapon.curses.fragile.desc=Fragile weapons start out just as strong as the items.weapon.curses.friendly.name=friendly %s items.weapon.curses.friendly.desc=Friendly weapons are best suited for pacifists, occasionally triggering magic that makes it impossible to fight. +items.weapon.curses.polarized.name=polarized %s +items.weapon.curses.polarized.desc=A polarized weapon is affected by magic that causes its attack to either deal 50% more damage, or not damage at all. + items.weapon.curses.sacrificial.name=sacrificial %s items.weapon.curses.sacrificial.desc=Sacrificial weapons will demand blood from the wearer in return for attacking foes. The more healthy the wearer is, the more blood the curse will take. @@ -1192,6 +1195,12 @@ items.weapon.enchantments.projecting.desc=With this enchantment melee weapons wi items.weapon.enchantments.shocking.name=shocking %s items.weapon.enchantments.shocking.desc=Electricity arcs from a shocking weapon, dealing extra damage to all nearby enemies. +items.weapon.enchantments.swift.name=swift %s +items.weapon.enchantments.swift.desc=A swift weapon can allow the wielder to instantly follow up their attack with a second weapon. The two weapons must be of different types however: one ranged, and one melee. +items.weapon.enchantments.swift$swiftattack.name=Swift Attack +items.weapon.enchantments.swift$swiftattack.desc_melee=The swift enchantment on your melee weapon has made your next attack with a ranged weapon instantaneous. The effect will only last briefly though! +items.weapon.enchantments.swift$swiftattack.desc_ranged=The swift enchantment on your ranged weapon has made your next attack with a melee weapon instantaneous. The effect will only last briefly though! + items.weapon.enchantments.unstable.name=unstable %s items.weapon.enchantments.unstable.desc=This enchantment radiates chaotic energy, acting as a different enchantment with each hit.