From 2a7b94d51d9f2bccc69ab10ecc26ace826f04a79 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 7 Sep 2020 19:03:53 -0400 Subject: [PATCH] v0.9.0: reworked the Pharmacophobia challenge --- .../assets/messages/items/items.properties | 1 + .../main/assets/messages/misc/misc.properties | 4 ++-- .../shatteredpixeldungeon/Challenges.java | 11 --------- .../items/bombs/RegrowthBomb.java | 4 +--- .../items/potions/AlchemicalCatalyst.java | 5 ++++ .../items/potions/PotionOfHealing.java | 24 ++++++++++++++++--- .../elixirs/ElixirOfAquaticRejuvenation.java | 7 +++++- .../elixirs/ElixirOfHoneyedHealing.java | 6 ++--- .../potions/exotic/PotionOfShielding.java | 13 +++++++--- .../weapon/missiles/darts/HealingDart.java | 2 +- 10 files changed, 49 insertions(+), 28 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index afa2ff8af..f529029b7 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -615,6 +615,7 @@ items.potions.potionofhaste.desc=Drinking this oddly sweet liquid will imbue you items.potions.potionofhealing.name=potion of healing items.potions.potionofhealing.heal=Your wounds begin to close. +items.potions.potionofhealing.poison=You feel sick! items.potions.potionofhealing.desc=This elixir will rapidly restore your health and instantly cure many ailments. items.potions.potionofinvisibility.name=potion of invisibility diff --git a/core/src/main/assets/messages/misc/misc.properties b/core/src/main/assets/messages/misc/misc.properties index 7fa8f93ce..cc5982f82 100644 --- a/core/src/main/assets/messages/misc/misc.properties +++ b/core/src/main/assets/messages/misc/misc.properties @@ -70,11 +70,11 @@ badges$badge.unlock_rogue=Unlocked the Rogue badges$badge.unlock_huntress=Unlocked the Huntress challenges.no_food=On diet -challenges.no_food_desc=Food's already scarce, but you have to watch your portions as welL!\n\n- Food and the horn of plenty are one third as effective at satisfying hunger\n- Other sources of satiety are unaffected +challenges.no_food_desc=Food's already scarce, but you have to watch your portions as well!\n\n- Food and the horn of plenty are one third as effective at satisfying hunger\n- Other sources of satiety are unaffected challenges.no_armor=Faith is my armor challenges.no_armor_desc=Take on the dungeon with nothing but some cloth to protect you!\n\n- All armor except starting cloth is removed challenges.no_healing=Pharmacophobia -challenges.no_healing_desc=Without healing potions, you'll need to rely on alternate healing sources to survive\n\n- Potions of healing are removed +challenges.no_healing_desc=Healing potions sure are handy, unfortunately you're allergic!\n\n- Potions of healing, and items made using potions of healing, poison the hero instead of healing them\n- Alchemical catalysts cannot randomly poison or heal the hero\n- These items still work normally for other characters challenges.no_herbalism=Barren land challenges.no_herbalism_desc=There seems to be no clean water left in this accursed dungeon...\n\n- Dew drops are removed\n- Plants are removed\n- Seeds still appear, but will not take root challenges.swarm_intelligence=Swarm intelligence diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java index ad3e5409f..b42900170 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java @@ -26,8 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; -import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; -import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; public class Challenges { @@ -64,15 +62,6 @@ public class Challenges { } } - if (Dungeon.isChallenged(NO_HEALING)){ - if (item instanceof PotionOfHealing){ - return true; - } else if (item instanceof Blandfruit - && ((Blandfruit) item).potionAttrib instanceof PotionOfHealing){ - return true; - } - } - if (Dungeon.isChallenged(NO_HERBALISM)){ if (item instanceof Dewdrop) { return true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/RegrowthBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/RegrowthBomb.java index 2783051cc..9e59e5774 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/RegrowthBomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/bombs/RegrowthBomb.java @@ -26,8 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Regrowth; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; @@ -72,8 +70,8 @@ public class RegrowthBomb extends Bomb { if (ch != null){ if (ch.alignment == Dungeon.hero.alignment) { //same as a healing potion - Buff.affect( ch, Healing.class ).setHeal((int)(0.8f*ch.HT + 14), 0.25f, 0); PotionOfHealing.cure(ch); + PotionOfHealing.heal(ch); } } else if ( Dungeon.level.map[i] == Terrain.EMPTY || Dungeon.level.map[i] == Terrain.EMBERS || diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/AlchemicalCatalyst.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/AlchemicalCatalyst.java index 566a27658..fa36b52ac 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/AlchemicalCatalyst.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/AlchemicalCatalyst.java @@ -21,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.ExoticPotion; @@ -58,6 +60,9 @@ public class AlchemicalCatalyst extends Potion { @Override public void apply(Hero hero) { Potion p = Reflection.newInstance(Random.chances(potionChances)); + while (Dungeon.isChallenged(Challenges.NO_HEALING) && p instanceof PotionOfHealing){ + p = Reflection.newInstance(Random.chances(potionChances)); + } p.anonymize(); p.apply(hero); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java index 22ae24889..cad9b409a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/PotionOfHealing.java @@ -21,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; @@ -49,10 +51,26 @@ public class PotionOfHealing extends Potion { @Override public void apply( Hero hero ) { setKnown(); - //starts out healing 30 hp, equalizes with hero health total at level 11 - Buff.affect( hero, Healing.class ).setHeal((int)(0.8f*hero.HT + 14), 0.25f, 0); cure( hero ); - GLog.p( Messages.get(this, "heal") ); + heal( hero ); + } + + public static void heal( Char ch ){ + if (ch == Dungeon.hero && Dungeon.isChallenged(Challenges.NO_HEALING)){ + pharmacophobiaProc(Dungeon.hero); + GLog.p( Messages.get(PotionOfHealing.class, "poison") ); + } else { + //starts out healing 30 hp, equalizes with hero health total at level 11 + Buff.affect(ch, Healing.class).setHeal((int) (0.8f * ch.HT + 14), 0.25f, 0); + if (ch == Dungeon.hero){ + GLog.p( Messages.get(PotionOfHealing.class, "heal") ); + } + } + } + + public static void pharmacophobiaProc( Hero hero ){ + // harms the hero for ~40% of their max HP in poison + Buff.affect( hero, Poison.class).set(4 + hero.lvl/2); } public static void cure( Char ch ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java index 79041666a..855d167d6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfAquaticRejuvenation.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -44,7 +45,11 @@ public class ElixirOfAquaticRejuvenation extends Elixir { @Override public void apply(Hero hero) { - Buff.affect(hero, AquaHealing.class).set(Math.round(hero.HT * 1.5f)); + if (Dungeon.isChallenged(Challenges.NO_HEALING)){ + PotionOfHealing.pharmacophobiaProc(hero); + } else { + Buff.affect(hero, AquaHealing.class).set(Math.round(hero.HT * 1.5f)); + } } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java index 54c313063..7d6a8658d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/elixirs/ElixirOfHoneyedHealing.java @@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee; @@ -43,8 +42,8 @@ public class ElixirOfHoneyedHealing extends Elixir { @Override public void apply(Hero hero) { - Buff.affect( hero, Healing.class ).setHeal((int)(0.8f*hero.HT + 14), 0.25f, 0); PotionOfHealing.cure(hero); + PotionOfHealing.heal(hero); Buff.affect(hero, Hunger.class).satisfy(Hunger.STARVING/5f); } @@ -57,12 +56,11 @@ public class ElixirOfHoneyedHealing extends Elixir { Char ch = Actor.findChar(cell); if (ch != null){ - Buff.affect( ch, Healing.class ).setHeal((int)(0.8f*ch.HT + 14), 0.25f, 0); PotionOfHealing.cure(ch); + PotionOfHealing.heal(ch); if (ch instanceof Bee && ch.alignment != curUser.alignment){ ch.alignment = Char.Alignment.ALLY; ((Bee)ch).setPotInfo(-1, null); - } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShielding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShielding.java index 8c17b85ba..e57cbd123 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShielding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/exotic/PotionOfShielding.java @@ -21,9 +21,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class PotionOfShielding extends ExoticPotion { @@ -35,8 +38,12 @@ public class PotionOfShielding extends ExoticPotion { @Override public void apply(Hero hero) { setKnown(); - - //~75% of a potion of healing - Buff.affect(hero, Barrier.class).setShield((int)(0.6f*hero.HT + 10)); + + if (Dungeon.isChallenged(Challenges.NO_HEALING)){ + PotionOfHealing.pharmacophobiaProc(hero); + } else { + //~75% of a potion of healing + Buff.affect(hero, Barrier.class).setShield((int) (0.6f * hero.HT + 10)); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java index d53aea17d..32527c158 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/HealingDart.java @@ -37,8 +37,8 @@ public class HealingDart extends TippedDart { public int proc(Char attacker, Char defender, int damage) { //heals 30 hp at base, scaling with enemy HT - Buff.affect( defender, Healing.class ).setHeal((int)(0.5f*defender.HT + 30), 0.25f, 0); PotionOfHealing.cure( defender ); + Buff.affect( defender, Healing.class ).setHeal((int)(0.5f*defender.HT + 30), 0.25f, 0); if (attacker.alignment == defender.alignment){ return 0;