diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index ac8c6782e..c3acd81f1 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -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. 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 a5bd31b2d..a61cf5cd8 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 @@ -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;}}; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/cleric/Trinity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/cleric/Trinity.java index b102362de..dfa7183a9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/cleric/Trinity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/cleric/Trinity.java @@ -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)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/SpiritForm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/SpiritForm.java index 26ceee5e7..2814a0578 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/SpiritForm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/spells/SpiritForm.java @@ -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); + } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index fd3b445a2..2184a2e14 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -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 buffClass; private static final LinkedHashMap gems = new LinkedHashMap() { { @@ -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; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java index c4cad7191..a8de3aa45 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfAccuracy.java @@ -30,6 +30,7 @@ public class RingOfAccuracy extends Ring { { icon = ItemSpriteSheet.Icons.RING_ACCURACY; + buffClass = Accuracy.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfArcana.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfArcana.java index 85087f274..8a77d96de 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfArcana.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfArcana.java @@ -30,6 +30,7 @@ public class RingOfArcana extends Ring { { icon = ItemSpriteSheet.Icons.RING_ARCANA; + buffClass = Arcana.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java index 78226d32c..7c1f5f85b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java @@ -42,6 +42,7 @@ public class RingOfElements extends Ring { { icon = ItemSpriteSheet.Icons.RING_ELEMENTS; + buffClass = Resistance.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java index 653f038ed..a47b9c526 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEnergy.java @@ -33,6 +33,7 @@ public class RingOfEnergy extends Ring { { icon = ItemSpriteSheet.Icons.RING_ENERGY; + buffClass = Energy.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java index 24fb85efc..41c2e4501 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfEvasion.java @@ -30,6 +30,7 @@ public class RingOfEvasion extends Ring { { icon = ItemSpriteSheet.Icons.RING_EVASION; + buffClass = Evasion.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java index 4eb8be7f5..085eb9007 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java @@ -41,6 +41,7 @@ public class RingOfForce extends Ring { { icon = ItemSpriteSheet.Icons.RING_FORCE; + buffClass = Force.class; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java index 1f1a646b6..cab830751 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfFuror.java @@ -30,6 +30,7 @@ public class RingOfFuror extends Ring { { icon = ItemSpriteSheet.Icons.RING_FUROR; + buffClass = Furor.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java index 1d56a274d..3b8b8d6da 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfHaste.java @@ -30,6 +30,7 @@ public class RingOfHaste extends Ring { { icon = ItemSpriteSheet.Icons.RING_HASTE; + buffClass = Haste.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java index 7ae7c20ab..df2d618e5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfMight.java @@ -33,6 +33,7 @@ public class RingOfMight extends Ring { { icon = ItemSpriteSheet.Icons.RING_MIGHT; + buffClass = Might.class; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java index df224d3d1..3ce8f4f29 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java @@ -30,6 +30,7 @@ public class RingOfSharpshooting extends Ring { { icon = ItemSpriteSheet.Icons.RING_SHARPSHOOT; + buffClass = Aim.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java index 5c6bdcdb4..6c392914e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfTenacity.java @@ -30,6 +30,7 @@ public class RingOfTenacity extends Ring { { icon = ItemSpriteSheet.Icons.RING_TENACITY; + buffClass = Tenacity.class; } public String statsInfo() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java index 234e4a3fa..476a3262f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java @@ -56,6 +56,7 @@ public class RingOfWealth extends Ring { { icon = ItemSpriteSheet.Icons.RING_WEALTH; + buffClass = Wealth.class; } private float triesToDrop = Float.MIN_VALUE;