From eef60d6c7e1af648a05940d95b053983317d35fc Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 12 Feb 2021 20:09:19 -0500 Subject: [PATCH] v0.9.2: implemented the enraged catalyst talent --- core/src/main/assets/messages/actors/actors.properties | 2 ++ .../shatteredpixeldungeon/actors/buffs/Berserk.java | 4 ++++ .../shatteredpixeldungeon/actors/hero/Talent.java | 4 ++-- .../shatteredpixeldungeon/items/weapon/Weapon.java | 10 ++++++++++ .../items/weapon/curses/Annoying.java | 3 ++- .../items/weapon/curses/Displacing.java | 3 ++- .../items/weapon/curses/Exhausting.java | 3 ++- .../items/weapon/curses/Friendly.java | 5 +++-- .../items/weapon/curses/Polarized.java | 5 +++-- .../items/weapon/curses/Sacrificial.java | 3 ++- .../items/weapon/enchantments/Blazing.java | 7 ++++--- .../items/weapon/enchantments/Blooming.java | 8 ++++---- .../items/weapon/enchantments/Chilling.java | 7 ++++--- .../items/weapon/enchantments/Corrupting.java | 3 ++- .../items/weapon/enchantments/Elastic.java | 7 ++++--- .../items/weapon/enchantments/Grim.java | 4 +++- .../items/weapon/enchantments/Lucky.java | 4 ++-- .../items/weapon/enchantments/Shocking.java | 7 ++++--- .../items/weapon/enchantments/Vampiric.java | 2 ++ 19 files changed, 61 insertions(+), 30 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index cd229c49d..9c64b38b6 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -340,6 +340,8 @@ actors.hero.talent.endless_rage.title=endless rage actors.hero.talent.endless_rage.desc=_+1:_ The Berserker can reach a max of _115% rage_.\n\n_+2:_ The Berserker can reach a max of _130% rage_.\n\n_+3:_ The Berserker can reach a max of _145% rage_.\n\nNote that rage above 100% will not grant more than +50% damage. actors.hero.talent.berserking_stamina.title=berserking stamina actors.hero.talent.berserking_stamina.desc=_+1:_ The Berserker gains _17% more shield_ when berserking, and the berserking cooldown is reduced to _2.5 levels_ from 3.\n\n_+2:_ The Berserker gains _33% more shield_ when berserking, and the berserking cooldown is reduced to _2 levels_ from 3.\n\n_+3:_ The Berserker gains _50% more shield_ when berserking, and the berserking cooldown is reduced to _1.5 levels_ from 3. +actors.hero.talent.enraged_catalyst.title=enraged catalyst +actors.hero.talent.enraged_catalyst.desc=_+1:_ Enchantments and curses on the Berserker's weapon trigger more often the more rage he has, to a maximum of _20% more often_ at 100% rage.\n\n_+2:_ Enchantments and curses on the Berserker's weapon trigger more often the more rage he has, to a maximum of _40% more often_ at 100% rage.\n\n_+3:_ Enchantments and curses on the Berserker's weapon trigger more often the more rage he has, to a maximum of _60% more often_ at 100% rage. actors.hero.talent.cleave.title=cleave actors.hero.talent.cleave.desc=_+1:_ When the Gladiator kills an enemy, the combo cooldown for his next hit is increased to _10 turns_.\n\n_+2:_ When the Gladiator kills an enemy, the combo cooldown for his next hit is increased to _20 turns_.\n\n_+3:_ When the Gladiator kills an enemy, the combo cooldown for his next hit is increased to _30 turns_. actors.hero.talent.lethal_defense.title=lethal defense diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java index a511078ba..9c23527e0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Berserk.java @@ -104,6 +104,10 @@ public class Berserk extends Buff { return true; } + public float rageAmount(){ + return Math.min(1f, power); + } + public int damageFactor(int dmg){ float bonus = Math.min(1.5f, 1f + (power / 2f)); return Math.round(dmg * bonus); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index 86381b336..27c4da4a1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -73,7 +73,7 @@ public enum Talent { //Warrior T3 STRONGMAN(9, 3), WARRIOR_T3_2(10, 3), //Berserker T3 - ENDLESS_RAGE(11, 3), BERSERKING_STAMINA(12, 3), BERSERKER_T3_3(13, 3), + ENDLESS_RAGE(11, 3), BERSERKING_STAMINA(12, 3), ENRAGED_CATALYST(13, 3), //Gladiator T3 CLEAVE(14, 3), LETHAL_DEFENSE(15, 3), GLADIATOR_T3_3(16, 3), @@ -458,7 +458,7 @@ public enum Talent { //tier 3 switch (cls){ case BERSERKER: default: - Collections.addAll(tierTalents, ENDLESS_RAGE, BERSERKING_STAMINA, BERSERKER_T3_3); + Collections.addAll(tierTalents, ENDLESS_RAGE, BERSERKING_STAMINA, ENRAGED_CATALYST); break; case GLADIATOR: Collections.addAll(tierTalents, CLEAVE, LETHAL_DEFENSE, GLADIATOR_T3_3); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 9703c3caa..82622d327 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; @@ -346,6 +347,15 @@ abstract public class Weapon extends KindOfWeapon { public abstract int proc( Weapon weapon, Char attacker, Char defender, int damage ); + protected float procChanceMultiplier( Char attacker ){ + float multi = 1f; + if (attacker instanceof Hero && ((Hero) attacker).hasTalent(Talent.ENRAGED_CATALYST)){ + Berserk rage = attacker.buff(Berserk.class); + multi += 0.2f*rage.rageAmount()*((Hero) attacker).pointsInTalent(Talent.ENRAGED_CATALYST); + } + return multi; + } + public String name() { if (!curse()) return name( Messages.get(this, "enchant")); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Annoying.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Annoying.java index 1b8fbb79b..9539cdabc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Annoying.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Annoying.java @@ -41,7 +41,8 @@ public class Annoying extends Weapon.Enchantment { @Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { - if (Random.Int(20) == 0) { + float procChance = 1/20f * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) { mob.beckon(attacker.pos); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java index cfbb7d7ce..b71447133 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Displacing.java @@ -37,7 +37,8 @@ public class Displacing extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { - if (Random.Int(12) == 0 && !defender.properties().contains(Char.Property.IMMOVABLE)){ + float procChance = 1/12f * procChanceMultiplier(attacker); + if (Random.Float() < procChance && !defender.properties().contains(Char.Property.IMMOVABLE)){ int count = 10; int newPos; do { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Exhausting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Exhausting.java index 66ef1ff27..4f0607d49 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Exhausting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Exhausting.java @@ -36,7 +36,8 @@ public class Exhausting extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { - if (attacker == Dungeon.hero && Random.Int(15) == 0) { + float procChance = 1/15f * procChanceMultiplier(attacker); + if (attacker == Dungeon.hero && Random.Float() < procChance) { Buff.affect(attacker, Weakness.class, Random.NormalIntRange(5, 20)); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Friendly.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Friendly.java index 3d3dfc7ff..e739d4cbb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Friendly.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Friendly.java @@ -35,8 +35,9 @@ public class Friendly extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { - - if (Random.Int(10) == 0){ + + float procChance = 1/10f * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { Buff.affect( attacker, Charm.class, Charm.DURATION ).object = defender.id(); attacker.sprite.centerEmitter().start( Speck.factory( Speck.HEART ), 0.2f, 5 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java index 027bbd020..66d6b87cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Polarized.java @@ -32,8 +32,9 @@ public class Polarized extends Weapon.Enchantment { @Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { - - if (Random.Int(2) == 0){ + + float procChance = 1/2f * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { return Math.round(1.5f*damage); } else { return 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java index ce174d707..30af0105a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/curses/Sacrificial.java @@ -35,7 +35,8 @@ public class Sacrificial extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { - if (Random.Int(12) == 0){ + float procChance = 1/12f * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { Buff.affect(attacker, Bleeding.class).set(Math.max(1, attacker.HP/6)); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blazing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blazing.java index 980321365..6a93a8ec2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blazing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blazing.java @@ -37,12 +37,13 @@ public class Blazing extends Weapon.Enchantment { @Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + int level = Math.max( 0, weapon.buffedLvl() ); + // lvl 0 - 33% // lvl 1 - 50% // lvl 2 - 60% - int level = Math.max( 0, weapon.buffedLvl() ); - - if (Random.Int( level + 3 ) >= 2) { + float procChance = (level+1f)/(level+3f) * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { if (defender.buff(Burning.class) != null){ Buff.affect(defender, Burning.class).reignite(defender, 8f); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blooming.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blooming.java index a81e724a8..3f709c444 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blooming.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Blooming.java @@ -41,13 +41,13 @@ public class Blooming extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage) { - + int level = Math.max( 0, weapon.buffedLvl() ); + // lvl 0 - 33% // lvl 1 - 50% // lvl 2 - 60% - int level = Math.max( 0, weapon.buffedLvl() ); - - if (Random.Int( level + 3 ) >= 2) { + float procChance = (level+1f)/(level+3f) * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { boolean secondPlant = level > Random.Int(10); if (plantGrass(defender.pos)){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Chilling.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Chilling.java index 5de08d835..c8a116ac7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Chilling.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Chilling.java @@ -36,12 +36,13 @@ public class Chilling extends Weapon.Enchantment { @Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + int level = Math.max( 0, weapon.buffedLvl() ); + // lvl 0 - 25% // lvl 1 - 40% // lvl 2 - 50% - int level = Math.max( 0, weapon.buffedLvl() ); - - if (Random.Int( level + 4 ) >= 3) { + float procChance = (level+1f)/(level+4f) * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { //adds 3 turns of chill per proc, with a cap of 6 turns float durationToAdd = 3f; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java index 6eb70b290..3f5edfb16 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java @@ -48,8 +48,9 @@ public class Corrupting extends Weapon.Enchantment { // lvl 0 - 20% // lvl 1 ~ 23% // lvl 2 ~ 26% + float procChance = (level+5f)/(level+25f) * procChanceMultiplier(attacker); if (damage >= defender.HP - && Random.Int( level + 25 ) >= 20 + && Random.Float() < procChance && !defender.isImmune(Corruption.class) && defender.buff(Corruption.class) == null && defender instanceof Mob diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Elastic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Elastic.java index 880385ca7..c7c53c994 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Elastic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Elastic.java @@ -36,12 +36,13 @@ public class Elastic extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage ) { + int level = Math.max( 0, weapon.buffedLvl() ); + // lvl 0 - 20% // lvl 1 - 33% // lvl 2 - 43% - int level = Math.max( 0, weapon.buffedLvl() ); - - if (Random.Int( level + 5 ) >= 4) { + float procChance = (level+1f)/(level+5f) * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { //trace a ballistica to our target (which will also extend past them Ballistica trajectory = new Ballistica(attacker.pos, defender.pos, Ballistica.STOP_TARGET); //trim it to just be the part that goes past them diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Grim.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Grim.java index 9cef19863..29f5b61a8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Grim.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Grim.java @@ -46,7 +46,9 @@ public class Grim extends Weapon.Enchantment { float maxChance = 0.5f + .05f*level; float chanceMulti = (float)Math.pow( ((defender.HT - enemyHealth) / (float)defender.HT), 2); float chance = maxChance * chanceMulti; - + + chance *= procChanceMultiplier(attacker); + if (Random.Float() < chance) { defender.damage( defender.HP, this ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java index 49b3a9954..f21cea14f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java @@ -42,8 +42,8 @@ public class Lucky extends Weapon.Enchantment { // lvl 0 - 10% // lvl 1 ~ 12% // lvl 2 ~ 14% - if (defender.HP <= damage - && Random.Int( level + 40 ) >= 36){ + float procChance = (level+4f)/(level+40f) * procChanceMultiplier(attacker); + if (defender.HP <= damage && Random.Float() < procChance){ Buff.affect(defender, LuckProc.class); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shocking.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shocking.java index e5269ed0a..f5f2a016e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shocking.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shocking.java @@ -42,12 +42,13 @@ public class Shocking extends Weapon.Enchantment { @Override public int proc( Weapon weapon, Char attacker, Char defender, int damage ) { + int level = Math.max( 0, weapon.buffedLvl() ); + // lvl 0 - 25% // lvl 1 - 40% // lvl 2 - 50% - int level = Math.max( 0, weapon.buffedLvl() ); - - if (Random.Int( level + 4 ) >= 3) { + float procChance = (level+1f)/(level+4f) * procChanceMultiplier(attacker); + if (Random.Float() < procChance) { affected.clear(); arcs.clear(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Vampiric.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Vampiric.java index 5695baf4f..507c5f290 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Vampiric.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Vampiric.java @@ -39,6 +39,8 @@ public class Vampiric extends Weapon.Enchantment { //chance to heal scales from 5%-30% based on missing HP float missingPercent = (attacker.HT - attacker.HP) / (float)attacker.HT; float healChance = 0.05f + .25f*missingPercent; + + healChance *= procChanceMultiplier(attacker); if (Random.Float() < healChance){