From c46576a175d568bb8aee88ea53dd4916af6eef11 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 17 Sep 2020 00:20:50 -0400 Subject: [PATCH] v0.9.0: reworked the faith is my armor challenge --- .../main/assets/messages/misc/misc.properties | 2 +- .../shatteredpixeldungeon/Challenges.java | 15 ++---------- .../actors/mobs/Statue.java | 3 +-- .../items/armor/Armor.java | 9 ++++++++ .../windows/WndSadGhost.java | 23 ++++++++----------- 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/core/src/main/assets/messages/misc/misc.properties b/core/src/main/assets/messages/misc/misc.properties index cc5982f82..9a8044191 100644 --- a/core/src/main/assets/messages/misc/misc.properties +++ b/core/src/main/assets/messages/misc/misc.properties @@ -72,7 +72,7 @@ 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_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_armor_desc=You'll need faith in yourself, as your armor won't do much!\n\n- Base blocking power reduced for all armor except cloth\n- All armor now gains very little blocking when upgraded\n- Earthen guardian's defensive power is also significantly reduced. challenges.no_healing=Pharmacophobia 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 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java index b42900170..40e6bfe9e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Challenges.java @@ -23,9 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Dewdrop; 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; public class Challenges { @@ -56,16 +53,8 @@ public class Challenges { public static boolean isItemBlocked( Item item ){ - if (Dungeon.isChallenged(NO_ARMOR)){ - if (item instanceof Armor && !(item instanceof ClothArmor || item instanceof ClassArmor)) { - return true; - } - } - - if (Dungeon.isChallenged(NO_HERBALISM)){ - if (item instanceof Dewdrop) { - return true; - } + if (Dungeon.isChallenged(NO_HERBALISM) && item instanceof Dewdrop){ + return true; } return false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 1f88fd81f..ae7681b24 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -169,7 +168,7 @@ public class Statue extends Mob { } public static Statue random(){ - if (Random.Int(10) == 0 && !Dungeon.isChallenged(Challenges.NO_ARMOR)){ + if (Random.Int(10) == 0){ return new ArmoredStatue(); } else { return new Statue(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index 18823edf5..86442b650 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor; import com.shatteredpixel.shatteredpixeldungeon.Badges; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -265,6 +266,10 @@ public class Armor extends EquipableItem { } public int DRMax(int lvl){ + if (Dungeon.isChallenged(Challenges.NO_ARMOR)){ + return 1 + tier + lvl + augment.defenseFactor(lvl); + } + int max = tier * (2 + lvl) + augment.defenseFactor(lvl); if (lvl > max){ return ((lvl - max)+1)/2; @@ -278,6 +283,10 @@ public class Armor extends EquipableItem { } public int DRMin(int lvl){ + if (Dungeon.isChallenged(Challenges.NO_ARMOR)){ + return 0; + } + int max = DRMax(lvl); if (lvl >= max){ return (lvl - max); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java index 8fdb7fb4b..60d3c0018 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; -import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -82,20 +81,16 @@ public class WndSadGhost extends Window { btnWeapon.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnWeapon ); - if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) { - RedButton btnArmor = new RedButton( Messages.get(this, "armor") ) { - @Override - protected void onClick() { - selectReward(ghost, Ghost.Quest.armor); - } - }; - btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT); - add(btnArmor); + RedButton btnArmor = new RedButton( Messages.get(this, "armor") ) { + @Override + protected void onClick() { + selectReward(ghost, Ghost.Quest.armor); + } + }; + btnArmor.setRect(0, btnWeapon.bottom() + GAP, WIDTH, BTN_HEIGHT); + add(btnArmor); - resize(WIDTH, (int) btnArmor.bottom()); - } else { - resize(WIDTH, (int) btnWeapon.bottom()); - } + resize(WIDTH, (int) btnArmor.bottom()); } private void selectReward( Ghost ghost, Item reward ) {