v3.3.0: overhauled upgrade functionality on chalice of blood:

- now deals a range of damage, and shows that to the player
- all damage reduction sources now affect chalice
- range is triangular, and pre-reduction death % is also shown
This commit is contained in:
Evan Debenham
2025-10-15 12:45:17 -04:00
parent 8a40fa52bd
commit ffeb28ea55
3 changed files with 51 additions and 22 deletions

View File

@@ -186,13 +186,13 @@ items.artifacts.chaliceofblood.name=chalice of blood
items.artifacts.chaliceofblood.ac_prick=PRICK
items.artifacts.chaliceofblood.yes=Yes, I know what I'm doing
items.artifacts.chaliceofblood.no=No, I changed my mind
items.artifacts.chaliceofblood.prick_warn=Each time you use the chalice it will drain more life energy, if you are not careful this can easily kill you.\n\nAre you sure you want to offer it more life energy?
items.artifacts.chaliceofblood.prick_warn=Each time you use the chalice it will drain more of your life energy, but will further enhance your natural health regeneration in exchange.\n\nCurrently pricking yourself will deal _%1$d-%2$d damage_, although this damage can be reduced by _both physical and magical blocking or damage reduction._ Without considering damage reduction effects, pricking yourself currently has a _%3$s%% chance_ to drain your life force completely.\n\nAre you sure you want to offer the chalice more life energy?
items.artifacts.chaliceofblood.onprick=You prick yourself, and your life essence drains into the chalice.
items.artifacts.chaliceofblood.ondeath=The Chalice sucks your life essence dry...
items.artifacts.chaliceofblood.desc=This shining silver chalice is oddly adorned with sharp gems at the rim.
items.artifacts.chaliceofblood.desc_cursed=The cursed chalice has bound itself to your hand, and is inhibiting your ability to regenerate health.
items.artifacts.chaliceofblood.desc_1=As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems.
items.artifacts.chaliceofblood.desc_2=Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life energy into you. You still want to cut yourself on the chalice, even though you know it will hurt.
items.artifacts.chaliceofblood.desc_2=Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life energy into you, increasing your natural health regeneration. You still want to cut yourself on the chalice, even though you know it will hurt.
items.artifacts.chaliceofblood.desc_3=The chalice is filled to the brim with your life essence. You can feel the chalice pouring life energy back into you.
items.artifacts.cloakofshadows.name=cloak of shadows

View File

@@ -28,13 +28,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.Judgement;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.duelist.ElementalStrike;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.mage.ElementalBlast;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.mage.WarpBeacon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.GuidingLight;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.HolyLance;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.HolyWeapon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.Judgement;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.Smite;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.Sunray;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.CrystalWisp;
@@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Shaman;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Warlock;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.YogFist;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.ArcaneBomb;
import com.shatteredpixel.shatteredpixeldungeon.items.bombs.HolyBomb;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
@@ -114,6 +115,8 @@ public class AntiMagic extends Armor.Glyph {
RESISTS.add( WandOfTransfusion.class );
RESISTS.add( WandOfWarding.Ward.class );
RESISTS.add( ChaliceOfBlood.class );
RESISTS.add( ElementalStrike.class );
RESISTS.add( Blazing.class );
RESISTS.add( Shocking.class );

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
@@ -73,38 +74,63 @@ public class ChaliceOfBlood extends Artifact {
if (action.equals(AC_PRICK)){
int damage = 5 + 3*(level()*level());
int minDmg = minPrickDmg();
int maxDmg = maxPrickDmg();
if (damage > hero.HP*0.75) {
int totalHeroHP = hero.HP + hero.shielding();
GameScene.show(
new WndOptions(new ItemSprite(this),
Messages.titleCase(name()),
Messages.get(this, "prick_warn"),
Messages.get(this, "yes"),
Messages.get(this, "no")) {
@Override
protected void onSelect(int index) {
if (index == 0)
prick(Dungeon.hero);
float deathChance = 0;
if (totalHeroHP < maxDmg) {
deathChance = (maxDmg - totalHeroHP) / (float) (maxDmg - minDmg);
if (deathChance < 0.5f) {
deathChance = (float) Math.pow(2 * deathChance, 2) / 2f;
} else if (deathChance < 1f) {
deathChance = 1f - deathChance;
deathChance = (float) Math.pow(2 * deathChance, 2) / 2f;
deathChance = 1f - deathChance;
} else {
deathChance = 1;
}
}
GameScene.show(
new WndOptions(new ItemSprite(this),
Messages.titleCase(name()),
Messages.get(this, "prick_warn", minDmg, maxDmg, Messages.decimalFormat("#.##", 100*deathChance)),
Messages.get(this, "yes"),
Messages.get(this, "no")) {
@Override
protected void onSelect(int index) {
if (index == 0) {
prick(Dungeon.hero);
}
}
);
}
);
} else {
prick(hero);
}
}
}
private void prick(Hero hero){
int damage = 5 + 3*(level()*level());
private int minPrickDmg(){
return (int)Math.ceil(3 + 2.5f*(level()*level()));
}
private int maxPrickDmg(){
return (int)Math.floor(7 + 3.5f*(level()*level()));
}
private void prick(Hero hero){
int damage = Random.NormalIntRange(minPrickDmg(), maxPrickDmg());
//need to process on-hit effects manually
Earthroot.Armor armor = hero.buff(Earthroot.Armor.class);
if (armor != null) {
damage = armor.absorb(damage);
}
WandOfLivingEarth.RockArmor rockArmor = hero.buff(WandOfLivingEarth.RockArmor.class);
if (rockArmor != null) {
damage = rockArmor.absorb(damage);
@@ -114,7 +140,7 @@ public class ChaliceOfBlood extends Artifact {
hero.sprite.operate( hero.pos );
hero.busy();
hero.spend(3f);
hero.spend(Actor.TICK);
GLog.w( Messages.get(this, "onprick") );
if (damage <= 0){
damage = 1;