v3.0.0: added artifact effects for trinity
This commit is contained in:
@@ -555,7 +555,16 @@ actors.hero.abilities.cleric.trinity.wand_use=Trinity will zap this wand at _+%1
|
||||
actors.hero.abilities.cleric.trinity.wand_multi_use=Trinity will zap this _multi-charge_ wand at _+%1$d_ at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.thrown_use=Trinity will throw this weapon at _+%1$d_ at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.ring_use=Trinity will apply this ring's effect at _+%1$d_ for 20 turns, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.artifact_use=Trinity will apply this artifact's effect at _+%1$d_, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.alchemiststoolkit_use=Trinity will apply this artifact's remote alchemy effect, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.chaliceofblood_use=Trinity will apply this artifact's passive health regen effect at _+%1$d_ for 20 turns, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.driedrose_use=Trinity will use this artifact's effect to summon a corrupted friendly wraith with the HP of a _+%1$d_ ghost, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.etherealchains_use=Trinity will apply this artifact's chain-casting effect with reach at _+%1$d_, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.hornofplenty_use=Trinity will apply this artifact's snacking effect, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.masterthievesarmband_use=Trinity will apply this artifact's enemy robbing effect at _+%1$d_, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.sandalsofnature_use=Trinity will apply this artifact's root effect with a random harmful seed, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.talismanofforesight_use=Trinity will apply this artifact's scry effect at _+%1$d_, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.timekeepershourglass_use=Trinity will apply this artifact's time freeze effect with a _%1$d_ turn duration, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.unstablespellbook_use=Trinity will apply this artifact's random scroll effect with a _%1$d/10_ chance to offer the exotic version at no additional cost, at the cost of _%2$s charge._
|
||||
actors.hero.abilities.cleric.trinity.cost=The charge cost of this ability varies, but is most often _%d._
|
||||
actors.hero.abilities.cleric.trinity.short_desc=The Cleric gains a _Trinity_ of abilities, which emulate equipment they have seen and can be assigned by using new spells.
|
||||
actors.hero.abilities.cleric.trinity.desc=The Cleric gains a _Trinity_ of armor abilities, which can be assigned to various item effects by using three new spells. Each of these spells focuses on emulating the effects of different kinds of equipment that the Cleric has identified during this run: body form (weapons and armor), mind form (wands and thrown weapons), and spirit form (rings and artifacts).\n\nEach Trinity form can be imbued with one effect at a time, and the Cleric chooses which one to activate when using Trinity. Trinity will not duplicate the effect of something you already have equipped.
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells.SpiritForm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.ChaoticCenser;
|
||||
@@ -63,15 +64,25 @@ public class Regeneration extends Buff {
|
||||
}
|
||||
}
|
||||
|
||||
ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
|
||||
boolean chaliceCursed = false;
|
||||
int chaliceLevel = -1;
|
||||
if (target.buff(MagicImmune.class) == null) {
|
||||
if (Dungeon.hero.buff(ChaliceOfBlood.chaliceRegen.class) != null) {
|
||||
chaliceCursed = Dungeon.hero.buff(ChaliceOfBlood.chaliceRegen.class).isCursed();
|
||||
chaliceLevel = Dungeon.hero.buff(ChaliceOfBlood.chaliceRegen.class).itemLevel();
|
||||
} else if (Dungeon.hero.buff(SpiritForm.SpiritFormBuff.class) != null
|
||||
&& Dungeon.hero.buff(SpiritForm.SpiritFormBuff.class).artifact() instanceof ChaliceOfBlood) {
|
||||
chaliceLevel = SpiritForm.artifactLevel(); //TODO this doesn't work well atm due to prior delay
|
||||
}
|
||||
}
|
||||
|
||||
float delay = REGENERATION_DELAY;
|
||||
if (regenBuff != null && target.buff(MagicImmune.class) == null) {
|
||||
if (regenBuff.isCursed()) {
|
||||
if (chaliceLevel != -1 && target.buff(MagicImmune.class) == null) {
|
||||
if (chaliceCursed) {
|
||||
delay *= 1.5f;
|
||||
} else {
|
||||
//15% boost at +0, scaling to a 500% boost at +10
|
||||
delay -= 1.33f + regenBuff.itemLevel()*0.667f;
|
||||
delay -= 1.33f + chaliceLevel*0.667f;
|
||||
delay /= RingOfEnergy.artifactChargeMultiplier(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,13 @@ 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.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.ChaliceOfBlood;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfFireblast;
|
||||
@@ -227,19 +233,27 @@ public class Trinity extends ArmorAbility {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
Buff.prolong(Dungeon.hero, SpiritForm.SpiritFormBuff.class, SpiritForm.SpiritFormBuff.DURATION).setEffect(spiritForm);
|
||||
Invisibility.dispel();
|
||||
//Rings and the Chalice specifically get their passive effects for 20 turns
|
||||
if (spiritForm instanceof Ring || spiritForm instanceof ChaliceOfBlood) {
|
||||
Buff.prolong(Dungeon.hero, SpiritForm.SpiritFormBuff.class, SpiritForm.SpiritFormBuff.DURATION).setEffect(spiritForm);
|
||||
Dungeon.hero.spendAndNext(1f);
|
||||
} else {
|
||||
SpiritForm.applyActiveArtifactEffect(armor, (Artifact) spiritForm);
|
||||
//turn spending is handled within the application of the artifact effect
|
||||
}
|
||||
Sample.INSTANCE.play(Assets.Sounds.TELEPORT);
|
||||
Enchanting.show(Dungeon.hero, (Item)spiritForm);
|
||||
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!
|
||||
}
|
||||
};
|
||||
if (spiritForm instanceof Artifact){
|
||||
((Artifact) spiritForm).resetForTrinity(SpiritForm.artifactLevel());
|
||||
}
|
||||
|
||||
btnSpirit.icon(new ItemSprite((Item)spiritForm));
|
||||
btnSpirit.multiline = true;
|
||||
btnSpirit.setSize(width, 100); //for text layout
|
||||
@@ -477,7 +491,7 @@ public class Trinity extends ArmorAbility {
|
||||
return Messages.get(Trinity.class, "ring_use", SpiritForm.ringLevel(), Messages.decimalFormat("#.##", chargeUse));
|
||||
}
|
||||
if (Artifact.class.isAssignableFrom(cls)){
|
||||
return Messages.get(Trinity.class, "artifact_use", SpiritForm.artifactLevel(), Messages.decimalFormat("#.##", chargeUse));
|
||||
return Messages.get(Trinity.class, cls.getSimpleName() + "_use", SpiritForm.artifactLevel(), Messages.decimalFormat("#.##", chargeUse));
|
||||
}
|
||||
return "error!";
|
||||
|
||||
@@ -488,12 +502,12 @@ public class Trinity extends ArmorAbility {
|
||||
if (Weapon.Enchantment.class.isAssignableFrom(cls) || Armor.Glyph.class.isAssignableFrom(cls)) {
|
||||
for (Class ench : Weapon.Enchantment.rare) {
|
||||
if (ench.equals(cls)) {
|
||||
return 2*chargeUse;
|
||||
return 2*chargeUse; //50 charge
|
||||
}
|
||||
}
|
||||
for (Class glyph : Armor.Glyph.rare){
|
||||
if (glyph.equals(cls)){
|
||||
return 2*chargeUse;
|
||||
return 2*chargeUse; //50 charge
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,9 +515,14 @@ public class Trinity extends ArmorAbility {
|
||||
return 2*chargeUse;
|
||||
}
|
||||
if (Artifact.class.isAssignableFrom(cls)){
|
||||
return chargeUse; //TODO
|
||||
if (cls.equals(DriedRose.class) || cls.equals(UnstableSpellbook.class)){
|
||||
return 2*chargeUse; //50 charge
|
||||
}
|
||||
if (cls.equals(EtherealChains.class) || cls.equals(TalismanOfForesight.class) || cls.equals(TimekeepersHourglass.class)){
|
||||
return 1.4f*chargeUse; //35 charge
|
||||
}
|
||||
}
|
||||
//all other effects are standard charge use
|
||||
//all other effects are standard charge use, 25 at base
|
||||
return chargeUse;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,21 +22,49 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Corruption;
|
||||
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.actors.mobs.Wraith;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.AlchemistsToolkit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TalismanOfForesight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMight;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Fadeleaf;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Firebloom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Icecap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Sorrowmoss;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Stormvine;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SpiritForm extends ClericSpell {
|
||||
|
||||
@@ -49,7 +77,7 @@ public class SpiritForm extends ClericSpell {
|
||||
|
||||
@Override
|
||||
public float chargeUse(Hero hero) {
|
||||
return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,4 +185,58 @@ public class SpiritForm extends ClericSpell {
|
||||
|
||||
}
|
||||
|
||||
public static void applyActiveArtifactEffect(ClassArmor armor, Artifact effect){
|
||||
if (effect instanceof AlchemistsToolkit){
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
AlchemyScene.assignToolkit((AlchemistsToolkit) effect);
|
||||
Game.switchScene(AlchemyScene.class);
|
||||
|
||||
} else if (effect instanceof DriedRose){
|
||||
ArrayList<Integer> spawnPoints = new ArrayList<>();
|
||||
for (int i = 0; i < PathFinder.NEIGHBOURS8.length; i++) {
|
||||
int p = Dungeon.hero.pos + PathFinder.NEIGHBOURS8[i];
|
||||
if (Actor.findChar(p) == null && (Dungeon.level.passable[p] || Dungeon.level.avoid[p])) {
|
||||
spawnPoints.add(p);
|
||||
}
|
||||
}
|
||||
if (spawnPoints.size() > 0) {
|
||||
Wraith w = Wraith.spawnAt(Random.element(spawnPoints), Wraith.class);
|
||||
w.HP = w.HT = 20 + 8*artifactLevel();
|
||||
Buff.affect(w, Corruption.class);
|
||||
}
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
Dungeon.hero.spendAndNext(1f);
|
||||
|
||||
} else if (effect instanceof EtherealChains){
|
||||
GameScene.selectCell(((EtherealChains) effect).caster);
|
||||
QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(armor));
|
||||
|
||||
} else if (effect instanceof HornOfPlenty){
|
||||
((HornOfPlenty) effect).doEatEffect(Dungeon.hero, 1);
|
||||
|
||||
} else if (effect instanceof MasterThievesArmband){
|
||||
GameScene.selectCell(((MasterThievesArmband) effect).targeter);
|
||||
QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(armor));
|
||||
|
||||
} else if (effect instanceof SandalsOfNature){
|
||||
((SandalsOfNature) effect).curSeedEffect = Random.oneOf(
|
||||
Blindweed.Seed.class, Fadeleaf.Seed.class, Firebloom.Seed.class,
|
||||
Icecap.Seed.class, Sorrowmoss.Seed.class, Stormvine.Seed.class
|
||||
);
|
||||
|
||||
GameScene.selectCell(((SandalsOfNature) effect).cellSelector);
|
||||
QuickSlotButton.useTargeting(Dungeon.quickslot.getSlot(armor));
|
||||
|
||||
} else if (effect instanceof TalismanOfForesight){
|
||||
GameScene.selectCell(((TalismanOfForesight) effect).scry);
|
||||
|
||||
} else if (effect instanceof TimekeepersHourglass){
|
||||
Buff.affect(Dungeon.hero, Swiftthistle.TimeBubble.class).reset(artifactLevel());
|
||||
Dungeon.hero.spendAndNext(1f);
|
||||
|
||||
} else if (effect instanceof UnstableSpellbook){
|
||||
((UnstableSpellbook) effect).doReadEffect(Dungeon.hero);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,6 +137,13 @@ public class Artifact extends KindofMisc {
|
||||
upgrade(Math.round((transferLvl*levelCap)/10f));
|
||||
}
|
||||
|
||||
public void resetForTrinity(int visibleLevel){
|
||||
level(Math.round((visibleLevel*levelCap)/10f));
|
||||
exp = Integer.MIN_VALUE; //ensures no levelling
|
||||
charge = chargeCap;
|
||||
cooldown = 0;
|
||||
}
|
||||
|
||||
public static void artifactProc(Char target, int artifLevel, int chargesUsed){
|
||||
if (Dungeon.hero.subClass == HeroSubClass.PRIEST && target.buff(GuidingLight.Illuminated.class) != null) {
|
||||
target.buff(GuidingLight.Illuminated.class).detach();
|
||||
|
||||
@@ -114,7 +114,13 @@ public class EtherealChains extends Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
private CellSelector.Listener caster = new CellSelector.Listener(){
|
||||
@Override
|
||||
public void resetForTrinity(int visibleLevel) {
|
||||
super.resetForTrinity(visibleLevel);
|
||||
charge = 5+(level()*2); //sets charge to soft cap
|
||||
}
|
||||
|
||||
public CellSelector.Listener caster = new CellSelector.Listener(){
|
||||
|
||||
@Override
|
||||
public void onSelect(Integer target) {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class HornOfPlenty extends Artifact {
|
||||
|
||||
defaultAction = AC_SNACK;
|
||||
}
|
||||
|
||||
|
||||
private int storedFoodEnergy = 0;
|
||||
|
||||
public static final String AC_SNACK = "SNACK";
|
||||
@@ -114,40 +114,7 @@ public class HornOfPlenty extends Artifact {
|
||||
chargesToUse = 1;
|
||||
}
|
||||
|
||||
hunger.satisfy(satietyPerCharge * chargesToUse);
|
||||
|
||||
Statistics.foodEaten++;
|
||||
|
||||
charge -= chargesToUse;
|
||||
Talent.onArtifactUsed(hero);
|
||||
|
||||
hero.sprite.operate(hero.pos);
|
||||
hero.busy();
|
||||
SpellSprite.show(hero, SpellSprite.FOOD);
|
||||
Sample.INSTANCE.play(Assets.Sounds.EAT);
|
||||
GLog.i( Messages.get(this, "eat") );
|
||||
|
||||
if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH)
|
||||
|| Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.MYSTICAL_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.FOCUSED_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.ENLIGHTENING_MEAL)){
|
||||
hero.spend(Food.TIME_TO_EAT - 2);
|
||||
} else {
|
||||
hero.spend(Food.TIME_TO_EAT);
|
||||
}
|
||||
|
||||
Talent.onFoodEaten(hero, satietyPerCharge * chargesToUse, this);
|
||||
|
||||
Badges.validateFoodEaten();
|
||||
|
||||
if (charge >= 8) image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||
else if (charge >= 2) image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||
else image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
updateQuickslot();
|
||||
doEatEffect(hero, chargesToUse);
|
||||
}
|
||||
|
||||
} else if (action.equals(AC_STORE)){
|
||||
@@ -157,6 +124,48 @@ public class HornOfPlenty extends Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
public void doEatEffect(Hero hero, int chargesToUse){
|
||||
int satietyPerCharge = (int) (Hunger.STARVING/5f);
|
||||
if (Dungeon.isChallenged(Challenges.NO_FOOD)){
|
||||
satietyPerCharge /= 3;
|
||||
}
|
||||
|
||||
Buff.affect(hero, Hunger.class).satisfy(satietyPerCharge * chargesToUse);
|
||||
|
||||
Statistics.foodEaten++;
|
||||
|
||||
charge -= chargesToUse;
|
||||
Talent.onArtifactUsed(hero);
|
||||
|
||||
hero.sprite.operate(hero.pos);
|
||||
hero.busy();
|
||||
SpellSprite.show(hero, SpellSprite.FOOD);
|
||||
Sample.INSTANCE.play(Assets.Sounds.EAT);
|
||||
GLog.i( Messages.get(this, "eat") );
|
||||
|
||||
if (Dungeon.hero.hasTalent(Talent.IRON_STOMACH)
|
||||
|| Dungeon.hero.hasTalent(Talent.ENERGIZING_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.MYSTICAL_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.INVIGORATING_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.FOCUSED_MEAL)
|
||||
|| Dungeon.hero.hasTalent(Talent.ENLIGHTENING_MEAL)){
|
||||
hero.spend(Food.TIME_TO_EAT - 2);
|
||||
} else {
|
||||
hero.spend(Food.TIME_TO_EAT);
|
||||
}
|
||||
|
||||
Talent.onFoodEaten(hero, satietyPerCharge * chargesToUse, this);
|
||||
|
||||
Badges.validateFoodEaten();
|
||||
|
||||
if (charge >= 8) image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||
else if (charge >= 2) image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||
else image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArtifactBuff passiveBuff() {
|
||||
return new hornRecharge();
|
||||
|
||||
@@ -110,7 +110,7 @@ public class MasterThievesArmband extends Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
private CellSelector.Listener targeter = new CellSelector.Listener(){
|
||||
public CellSelector.Listener targeter = new CellSelector.Listener(){
|
||||
|
||||
@Override
|
||||
public void onSelect(Integer target) {
|
||||
|
||||
@@ -237,6 +237,12 @@ public class SandalsOfNature extends Artifact {
|
||||
&& (level() < 3 || curSeedEffect != item.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForTrinity(int visibleLevel) {
|
||||
super.reset();
|
||||
curSeedEffect = null;
|
||||
}
|
||||
|
||||
private static final String SEEDS = "seeds";
|
||||
private static final String CUR_SEED_EFFECT = "cur_seed_effect";
|
||||
|
||||
@@ -322,7 +328,7 @@ public class SandalsOfNature extends Artifact {
|
||||
}
|
||||
};
|
||||
|
||||
protected CellSelector.Listener cellSelector = new CellSelector.Listener(){
|
||||
public CellSelector.Listener cellSelector = new CellSelector.Listener(){
|
||||
|
||||
@Override
|
||||
public void onSelect(Integer cell) {
|
||||
|
||||
@@ -135,7 +135,7 @@ public class TalismanOfForesight extends Artifact {
|
||||
return Math.min(5 + 2*level(), (charge-3)/1.08f);
|
||||
}
|
||||
|
||||
private CellSelector.Listener scry = new CellSelector.Listener(){
|
||||
public CellSelector.Listener scry = new CellSelector.Listener(){
|
||||
|
||||
@Override
|
||||
public void onSelect(Integer target) {
|
||||
|
||||
@@ -70,6 +70,12 @@ public class TimekeepersHourglass extends Artifact {
|
||||
defaultAction = AC_ACTIVATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForTrinity(int visibleLevel) {
|
||||
super.resetForTrinity(visibleLevel);
|
||||
charge = visibleLevel/2 - 1; //grants 4-10 turns of time freeze
|
||||
}
|
||||
|
||||
public static final String AC_ACTIVATE = "ACTIVATE";
|
||||
|
||||
//keeps track of generated sandbags.
|
||||
|
||||
@@ -85,6 +85,12 @@ public class UnstableSpellbook extends Artifact {
|
||||
public UnstableSpellbook() {
|
||||
super();
|
||||
|
||||
setupScrolls();
|
||||
}
|
||||
|
||||
private void setupScrolls(){
|
||||
scrolls.clear();
|
||||
|
||||
Class<?>[] scrollClasses = Generator.Category.SCROLL.classes;
|
||||
float[] probs = Generator.Category.SCROLL.defaultProbsTotal.clone(); //array of primitives, clone gives deep copy.
|
||||
int i = Random.chances(probs);
|
||||
@@ -124,75 +130,7 @@ public class UnstableSpellbook extends Artifact {
|
||||
else if (charge <= 0) GLog.i( Messages.get(this, "no_charge") );
|
||||
else if (cursed) GLog.i( Messages.get(this, "cursed") );
|
||||
else {
|
||||
charge--;
|
||||
|
||||
Scroll scroll;
|
||||
do {
|
||||
scroll = (Scroll) Generator.randomUsingDefaults(Generator.Category.SCROLL);
|
||||
} while (scroll == null
|
||||
//reduce the frequency of these scrolls by half
|
||||
||((scroll instanceof ScrollOfIdentify ||
|
||||
scroll instanceof ScrollOfRemoveCurse ||
|
||||
scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)
|
||||
//cannot roll transmutation
|
||||
|| (scroll instanceof ScrollOfTransmutation));
|
||||
|
||||
scroll.anonymize();
|
||||
curItem = scroll;
|
||||
curUser = hero;
|
||||
|
||||
//if there are charges left and the scroll has been given to the book
|
||||
if (charge > 0 && !scrolls.contains(scroll.getClass())) {
|
||||
final Scroll fScroll = scroll;
|
||||
|
||||
final ExploitHandler handler = Buff.affect(hero, ExploitHandler.class);
|
||||
handler.scroll = scroll;
|
||||
|
||||
GameScene.show(new WndOptions(new ItemSprite(this),
|
||||
Messages.get(this, "prompt"),
|
||||
Messages.get(this, "read_empowered"),
|
||||
scroll.trueName(),
|
||||
Messages.get(ExoticScroll.regToExo.get(scroll.getClass()), "name")){
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
handler.detach();
|
||||
if (index == 1){
|
||||
Scroll scroll = Reflection.newInstance(ExoticScroll.regToExo.get(fScroll.getClass()));
|
||||
curItem = scroll;
|
||||
charge--;
|
||||
scroll.anonymize();
|
||||
checkForArtifactProc(curUser, scroll);
|
||||
scroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
} else {
|
||||
checkForArtifactProc(curUser, fScroll);
|
||||
fScroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
}
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//do nothing
|
||||
}
|
||||
});
|
||||
} else {
|
||||
checkForArtifactProc(curUser, scroll);
|
||||
scroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
}
|
||||
|
||||
//scrolls that are AOE on all visible:
|
||||
//lullaby
|
||||
// rage, challenge(?)
|
||||
// retrib, psy blast
|
||||
// terror, dread
|
||||
|
||||
//Scrolls that are targeted:
|
||||
//siren's song (also AOE tho)
|
||||
|
||||
updateQuickslot();
|
||||
doReadEffect(hero);
|
||||
}
|
||||
|
||||
} else if (action.equals( AC_ADD )) {
|
||||
@@ -200,6 +138,69 @@ public class UnstableSpellbook extends Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
public void doReadEffect(Hero hero){
|
||||
charge--;
|
||||
|
||||
Scroll scroll;
|
||||
do {
|
||||
scroll = (Scroll) Generator.randomUsingDefaults(Generator.Category.SCROLL);
|
||||
} while (scroll == null
|
||||
//reduce the frequency of these scrolls by half
|
||||
||((scroll instanceof ScrollOfIdentify ||
|
||||
scroll instanceof ScrollOfRemoveCurse ||
|
||||
scroll instanceof ScrollOfMagicMapping) && Random.Int(2) == 0)
|
||||
//cannot roll transmutation
|
||||
|| (scroll instanceof ScrollOfTransmutation));
|
||||
|
||||
scroll.anonymize();
|
||||
curItem = scroll;
|
||||
curUser = hero;
|
||||
|
||||
//if there are charges left and the scroll has been given to the book
|
||||
if (charge > 0 && !scrolls.contains(scroll.getClass())) {
|
||||
final Scroll fScroll = scroll;
|
||||
|
||||
final ExploitHandler handler = Buff.affect(hero, ExploitHandler.class);
|
||||
handler.scroll = scroll;
|
||||
|
||||
GameScene.show(new WndOptions(new ItemSprite(this),
|
||||
Messages.get(this, "prompt"),
|
||||
Messages.get(this, "read_empowered"),
|
||||
scroll.trueName(),
|
||||
Messages.get(ExoticScroll.regToExo.get(scroll.getClass()), "name")){
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
handler.detach();
|
||||
if (index == 1){
|
||||
Scroll scroll = Reflection.newInstance(ExoticScroll.regToExo.get(fScroll.getClass()));
|
||||
curItem = scroll;
|
||||
charge--;
|
||||
scroll.anonymize();
|
||||
checkForArtifactProc(curUser, scroll);
|
||||
scroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
} else {
|
||||
checkForArtifactProc(curUser, fScroll);
|
||||
fScroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
}
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
//do nothing
|
||||
}
|
||||
});
|
||||
} else {
|
||||
checkForArtifactProc(curUser, scroll);
|
||||
scroll.doRead();
|
||||
Talent.onArtifactUsed(Dungeon.hero);
|
||||
}
|
||||
|
||||
updateQuickslot();
|
||||
}
|
||||
|
||||
private void checkForArtifactProc(Hero user, Scroll scroll){
|
||||
//if the base scroll (exotics all match) is an AOE effect, then also trigger illuminate
|
||||
if (scroll instanceof ScrollOfLullaby
|
||||
@@ -277,12 +278,22 @@ public class UnstableSpellbook extends Artifact {
|
||||
chargeCap = (int)((level()+1)*0.6f)+2;
|
||||
|
||||
//for artifact transmutation.
|
||||
while (!scrolls.isEmpty() && scrolls.size() > (levelCap-1-level()))
|
||||
while (!scrolls.isEmpty() && scrolls.size() > (levelCap-1-level())) {
|
||||
scrolls.remove(0);
|
||||
}
|
||||
|
||||
return super.upgrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForTrinity(int visibleLevel) {
|
||||
super.resetForTrinity(visibleLevel);
|
||||
setupScrolls();
|
||||
while (!scrolls.isEmpty() && scrolls.size() > (levelCap-1-level())) {
|
||||
scrolls.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String desc = super.desc();
|
||||
|
||||
@@ -96,9 +96,13 @@ public class Swiftthistle extends Plant {
|
||||
public String iconTextDisplay() {
|
||||
return Integer.toString((int)(left + 0.001f));
|
||||
}
|
||||
|
||||
|
||||
public void reset(){
|
||||
left = 7f;
|
||||
reset(6);
|
||||
}
|
||||
|
||||
public void reset(int turns){
|
||||
left = turns + 1; //add 1 as we're spending it on our action
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user