v3.0.0: Implemented Trinity spirit form for rings

This commit is contained in:
Evan Debenham
2025-02-05 13:28:48 -05:00
parent 94f6e03198
commit bad258d2b4
17 changed files with 145 additions and 6 deletions

View File

@@ -706,6 +706,8 @@ actors.hero.spells.shieldoflight$shieldoflighttracker.desc=A thin shield of ligh
actors.hero.spells.spiritform.name=spirit form
actors.hero.spells.spiritform.short_desc=Assigns Trinity to a ring or artifact.
actors.hero.spells.spiritform.desc=The Cleric chooses a ring or artifact that they have identified this run (except the holy tome) and imbues Trinity with its effect.\n\nIf a ring is chosen, then Trinity grants that ring's effect at +%1$d for 20 turns.\n\nIf an artifact is chosen, then Trinity replicates that Artifact's effect at +%2$d. Each artifact has different specific behaviors and armor charge costs when used with Trinity.\n\nThis spell replaces any other spirit effect that Trinity is currently imbued with.
actors.hero.spells.spiritform$spiritformbuff.name=spirit form
actors.hero.spells.spiritform$spiritformbuff.desc=Trinity's spirit form is currently granting you the power of an item, as if you had it equipped.\n\nNote that spirit form cannot provide another copy of an effect that you're already benefitting from.\n\nCurrent Effect: %1$s.\n\nTurns Remaining: %2$s.
actors.hero.spells.smite.name=smite
actors.hero.spells.smite.short_desc=Guarantees a hit with bonus damage and enchant power.

View File

@@ -550,6 +550,11 @@ public enum Talent {
}
}
}
//if we happen to have spirit form applied with a ring of might
if (talent == SPIRIT_FORM){
Dungeon.hero.updateHT(false);
}
}
public static class CachedRationsDropped extends CounterBuff{{revivePersists = true;}};

View File

@@ -195,13 +195,24 @@ public class Trinity extends ArmorAbility {
+ " " + trinityItemUseText(spiritForm.getClass()), 6){
@Override
protected void onClick() {
if (Dungeon.hero.belongings.ring().getClass().equals(spiritForm.getClass())
|| Dungeon.hero.belongings.misc().getClass().equals(spiritForm.getClass())
|| Dungeon.hero.belongings.artifact().getClass().equals(spiritForm.getClass())){
if ((Dungeon.hero.belongings.ring() != null && Dungeon.hero.belongings.ring().getClass().equals(spiritForm.getClass()))
|| (Dungeon.hero.belongings.misc() != null && Dungeon.hero.belongings.misc().getClass().equals(spiritForm.getClass()))
|| (Dungeon.hero.belongings.artifact() != null && Dungeon.hero.belongings.artifact().getClass().equals(spiritForm.getClass()))){
GLog.w(Messages.get(Trinity.class, "no_duplicate"));
hide();
return;
}
//TODO
Buff.affect(Dungeon.hero, SpiritForm.SpiritFormBuff.class, SpiritForm.SpiritFormBuff.DURATION).setEffect(spiritForm);
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
Enchanting.show(Dungeon.hero, (Item)spiritForm);
Dungeon.hero.sprite.operate(Dungeon.hero.pos);
Dungeon.hero.spendAndNext(1f);
armor.charge -= trinityChargeUsePerEffect(spiritForm.getClass());
armor.updateQuickslot();
Invisibility.dispel();
hide();
//TODO artifacts!
}
};
btnSpirit.icon(new ItemSprite((Item)spiritForm));

View File

@@ -22,12 +22,21 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.cleric.Trinity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMight;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
public class SpiritForm extends ClericSpell {
@@ -56,11 +65,96 @@ public class SpiritForm extends ClericSpell {
}
public static int ringLevel(){
return Dungeon.hero.pointsInTalent(Talent.MIND_FORM);
return Dungeon.hero.pointsInTalent(Talent.SPIRIT_FORM);
}
public static int artifactLevel(){
return 2 + 2*Dungeon.hero.pointsInTalent(Talent.MIND_FORM);
return 2 + 2*Dungeon.hero.pointsInTalent(Talent.SPIRIT_FORM);
}
public static class SpiritFormBuff extends FlavourBuff{
{
type = buffType.POSITIVE;
}
public static final float DURATION = 20f;
private Bundlable effect;
@Override
public int icon() {
return BuffIndicator.TRINITY_FORM;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(0, 1, 0);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
public void setEffect(Bundlable effect){
this.effect = effect;
if (effect instanceof RingOfMight){
((Ring) effect).level(ringLevel());
Dungeon.hero.updateHT( false );
}
}
@Override
public void detach() {
super.detach();
if (effect instanceof RingOfMight){
Dungeon.hero.updateHT( false );
}
}
public Ring ring(){
if (effect instanceof Ring){
((Ring) effect).level(ringLevel());
return (Ring) effect;
}
return null;
}
public Artifact artifact(){
if (effect instanceof Artifact){
if (((Artifact) effect).visiblyUpgraded() < artifactLevel()){
((Artifact) effect).transferUpgrade(artifactLevel() - ((Artifact) effect).visiblyUpgraded());
}
return (Artifact) effect;
}
return null;
}
@Override
public String desc() {
if (ring() != null){
return Messages.get(this, "desc", Messages.titleCase(ring().name()), dispTurns());
} else if (artifact() != null){
return Messages.get(this, "desc", Messages.titleCase(artifact().name()), dispTurns());
}
return super.desc();
}
private static final String EFFECT = "effect";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(EFFECT, effect);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
effect = bundle.get(EFFECT);
}
}
}

View File

@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EnhancedRings;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.SpiritForm;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
@@ -50,6 +51,7 @@ import java.util.LinkedHashMap;
public class Ring extends KindofMisc {
protected Buff buff;
protected Class<? extends RingBuff> buffClass;
private static final LinkedHashMap<String, Integer> gems = new LinkedHashMap<String, Integer>() {
{
@@ -368,6 +370,12 @@ public class Ring extends KindofMisc {
for (RingBuff buff : target.buffs(type)) {
bonus += buff.level();
}
if (bonus == 0
&& target.buff(SpiritForm.SpiritFormBuff.class) != null
&& target.buff(SpiritForm.SpiritFormBuff.class).ring() != null
&& target.buff(SpiritForm.SpiritFormBuff.class).ring().buffClass == type){
bonus += target.buff(SpiritForm.SpiritFormBuff.class).ring().soloBonus();
}
return bonus;
}
@@ -377,6 +385,13 @@ public class Ring extends KindofMisc {
for (RingBuff buff : target.buffs(type)) {
bonus += buff.buffedLvl();
}
if (bonus == 0
&& target.buff(SpiritForm.SpiritFormBuff.class) != null
&& target.buff(SpiritForm.SpiritFormBuff.class).ring() != null
&& target.buff(SpiritForm.SpiritFormBuff.class).ring().buffClass == type){
//TODO this works for all rings atm!
bonus += target.buff(SpiritForm.SpiritFormBuff.class).ring().soloBuffedBonus();
}
return bonus;
}

View File

@@ -30,6 +30,7 @@ public class RingOfAccuracy extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_ACCURACY;
buffClass = Accuracy.class;
}
public String statsInfo() {

View File

@@ -30,6 +30,7 @@ public class RingOfArcana extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_ARCANA;
buffClass = Arcana.class;
}
public String statsInfo() {

View File

@@ -42,6 +42,7 @@ public class RingOfElements extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_ELEMENTS;
buffClass = Resistance.class;
}
public String statsInfo() {

View File

@@ -33,6 +33,7 @@ public class RingOfEnergy extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_ENERGY;
buffClass = Energy.class;
}
public String statsInfo() {

View File

@@ -30,6 +30,7 @@ public class RingOfEvasion extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_EVASION;
buffClass = Evasion.class;
}
public String statsInfo() {

View File

@@ -41,6 +41,7 @@ public class RingOfForce extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_FORCE;
buffClass = Force.class;
}
@Override

View File

@@ -30,6 +30,7 @@ public class RingOfFuror extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_FUROR;
buffClass = Furor.class;
}
public String statsInfo() {

View File

@@ -30,6 +30,7 @@ public class RingOfHaste extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_HASTE;
buffClass = Haste.class;
}
public String statsInfo() {

View File

@@ -33,6 +33,7 @@ public class RingOfMight extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_MIGHT;
buffClass = Might.class;
}
@Override

View File

@@ -30,6 +30,7 @@ public class RingOfSharpshooting extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_SHARPSHOOT;
buffClass = Aim.class;
}
public String statsInfo() {

View File

@@ -30,6 +30,7 @@ public class RingOfTenacity extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_TENACITY;
buffClass = Tenacity.class;
}
public String statsInfo() {

View File

@@ -56,6 +56,7 @@ public class RingOfWealth extends Ring {
{
icon = ItemSpriteSheet.Icons.RING_WEALTH;
buffClass = Wealth.class;
}
private float triesToDrop = Float.MIN_VALUE;