v0.2.3: artifacts can now be cursed (couple rough edges to smooth out)

This commit is contained in:
Evan Debenham
2014-11-19 01:36:36 -05:00
parent 268435d390
commit 0ba2ca4302
12 changed files with 143 additions and 66 deletions
@@ -29,11 +29,12 @@ public class Regeneration extends Buff {
public boolean act() { public boolean act() {
if (target.isAlive()) { if (target.isAlive()) {
if (target.HP < target.HT && !((Hero)target).isStarving()) { ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
if (target.HP < target.HT && !((Hero)target).isStarving() && !(regenBuff != null && regenBuff.isCursed())) {
target.HP += 1; target.HP += 1;
} }
ChaliceOfBlood.chaliceRegen regenBuff = Dungeon.hero.buff( ChaliceOfBlood.chaliceRegen.class);
if (regenBuff != null) if (regenBuff != null)
spend( Math.max(REGENERATION_DELAY - regenBuff.level(), 0.5f) ); spend( Math.max(REGENERATION_DELAY - regenBuff.level(), 0.5f) );
else else
@@ -592,6 +592,8 @@ public class Hero extends Char {
} else { } else {
//TODO: this is triggering very rigidly, consider some sort of refactor
//specifically, right now is causing wrong output with a cursed horn of plenty.
if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade)item).isKnown()) || if ((item instanceof ScrollOfUpgrade && ((ScrollOfUpgrade)item).isKnown()) ||
(item instanceof PotionOfStrength && ((PotionOfStrength)item).isKnown())) { (item instanceof PotionOfStrength && ((PotionOfStrength)item).isKnown())) {
GLog.p( TXT_YOU_NOW_HAVE, item.name() ); GLog.p( TXT_YOU_NOW_HAVE, item.name() );
@@ -1368,7 +1370,7 @@ public class Hero extends Char {
for (int y = ay; y <= by; y++) { for (int y = ay; y <= by; y++) {
for (int x = ax, p = ax + y * Level.WIDTH; x <= bx; x++, p++) { for (int x = ax, p = ax + y * Level.WIDTH; x <= bx; x++, p++) {
if (Dungeon.visible[p]) { if (Dungeon.visible[p] && !(foresight != null && foresight.isCursed())) {
if (intentional) { if (intentional) {
sprite.parent.addToBack( new CheckedCell( p ) ); sprite.parent.addToBack( new CheckedCell( p ) );
@@ -24,8 +24,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery; import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfMight;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
@@ -116,6 +118,14 @@ public enum HeroClass {
if (!Dungeon.isChallenged(Challenges.NO_FOOD)) if (!Dungeon.isChallenged(Challenges.NO_FOOD))
new Food().identify().collect(); new Food().identify().collect();
new ScrollOfIdentify().collect();
HornOfPlenty horn = new HornOfPlenty();
horn.cursed = true;
horn.collect();
new RingOfMight().collect();
} }
public Badges.Badge masteryBadge() { public Badges.Badge masteryBadge() {
@@ -316,6 +316,8 @@ public class Generator {
cat.probs[i] = 0; cat.probs[i] = 0;
spawnedArtifacts.add(cat.classes[i].getSimpleName()); spawnedArtifacts.add(cat.classes[i].getSimpleName());
artifact.random();
return artifact; return artifact;
} catch (Exception e) { } catch (Exception e) {
@@ -1,12 +1,15 @@
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts; package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
@@ -14,10 +17,6 @@ import java.util.ArrayList;
* Created by Evan on 24/08/2014. * Created by Evan on 24/08/2014.
*/ */
public class Artifact extends KindofMisc { public class Artifact extends KindofMisc {
//TODO: add artifact transform method and tie it into well of transformation, scheduled for 0.2.3
{
levelKnown = true;
}
private static final float TIME_TO_EQUIP = 1f; private static final float TIME_TO_EQUIP = 1f;
@@ -83,6 +82,13 @@ public class Artifact extends KindofMisc {
activate( hero ); activate( hero );
cursedKnown = true;
identify();
if (cursed) {
equipCursed( hero );
GLog.n( "the " + this.name + " painfully binds itself to you" );
}
hero.spendAndNext( TIME_TO_EQUIP ); hero.spendAndNext( TIME_TO_EQUIP );
return true; return true;
@@ -133,14 +139,22 @@ public class Artifact extends KindofMisc {
} }
@Override @Override
public boolean isIdentified() { public String info() {
return true; if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) {
return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + ".";
} else {
return desc();
}
} }
@Override @Override
public String toString() { public String toString() {
if (levelKnown && level != 0) { if (levelKnown && level/levelCap != 0) {
if (chargeCap > 0) { if (chargeCap > 0) {
return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap ); return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap );
} else { } else {
@@ -155,6 +169,29 @@ public class Artifact extends KindofMisc {
} }
} }
@Override
public Item random() {
if (Random.Float() < 0.3f) {
cursed = true;
}
return this;
}
@Override
public int price() {
int price = 200;
if (level > 0)
price += 30*((level*10)/levelCap);
if (cursed && cursedKnown) {
price /= 2;
}
if (price < 1) {
price = 1;
}
return price;
}
protected ArtifactBuff passiveBuff() { protected ArtifactBuff passiveBuff() {
return null; return null;
} }
@@ -163,6 +200,14 @@ public class Artifact extends KindofMisc {
public class ArtifactBuff extends Buff { public class ArtifactBuff extends Buff {
public int level() {
return level;
}
public boolean isCursed() {
return cursed;
}
} }
private static final String IMAGE = "image"; private static final String IMAGE = "image";
@@ -187,18 +232,4 @@ public class Artifact extends KindofMisc {
charge = bundle.getInt( CHARGE ); charge = bundle.getInt( CHARGE );
partialCharge = bundle.getFloat( PARTIALCHARGE ); partialCharge = bundle.getFloat( PARTIALCHARGE );
} }
@Override
public int price() {
int price = 200;
if (level > 0)
price += 30*((level*10)/levelCap);
if (cursed && cursedKnown) {
price /= 2;
}
if (price < 1) {
price = 1;
}
return price;
}
} }
@@ -43,7 +43,7 @@ public class ChaliceOfBlood extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level < levelCap) if (isEquipped( hero ) && level < levelCap && !cursed)
actions.add(AC_PRICK); actions.add(AC_PRICK);
return actions; return actions;
} }
@@ -133,7 +133,9 @@ public class ChaliceOfBlood extends Artifact {
if (isEquipped (Dungeon.hero)){ if (isEquipped (Dungeon.hero)){
desc += "\n\n"; desc += "\n\n";
if (level == 0) if (cursed)
desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy.";
else if (level == 0)
desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems."; desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems.";
else if (level < 3) else if (level < 3)
desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " + desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " +
@@ -155,9 +157,7 @@ public class ChaliceOfBlood extends Artifact {
} }
public class chaliceRegen extends ArtifactBuff { public class chaliceRegen extends ArtifactBuff {
public int level() {
return level;
}
} }
} }
@@ -53,7 +53,7 @@ public class HornOfPlenty extends Artifact {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && charge > 0) if (isEquipped( hero ) && charge > 0)
actions.add(AC_EAT); actions.add(AC_EAT);
if (isEquipped( hero ) && level < 30) if (isEquipped( hero ) && level < 30 && !cursed)
actions.add(AC_STORE); actions.add(AC_STORE);
return actions; return actions;
} }
@@ -126,10 +126,15 @@ public class HornOfPlenty extends Artifact {
desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim."; desc += "The horn is overflowing! A delicious array of fruit and veg is filling the horn up to its brim.";
if ( isEquipped( Dungeon.hero ) ){ if ( isEquipped( Dungeon.hero ) ){
desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it."; if (!cursed) {
desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it.";
if (level < 15) if (level < 15)
desc += " Perhaps there is a way to increase the horn's power by giving it food energy."; desc += " Perhaps there is a way to increase the horn's power by giving it food energy.";
} else {
desc += "\n\nThe cursed horn has bound itself to your side, " +
"it seems to be eager to take food rather than produce it.";
}
} }
return desc; return desc;
@@ -144,7 +149,7 @@ public class HornOfPlenty extends Artifact {
@Override @Override
public boolean act() { public boolean act() {
if (charge < chargeCap) { if (charge < chargeCap && !cursed) {
//generates 0.2 food value every round, +0.01667 value per level //generates 0.2 food value every round, +0.01667 value per level
//to a max of ~0.7 food value per round (0.2+~0.5, at level 30) //to a max of ~0.7 food value per round (0.2+~0.5, at level 30)
@@ -48,7 +48,7 @@ public class SandalsOfNature extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level < 3) if (isEquipped( hero ) && level < 3 && !cursed)
actions.add(AC_FEED); actions.add(AC_FEED);
if (isEquipped( hero ) && charge > 0) if (isEquipped( hero ) && charge > 0)
actions.add(AC_ROOT); actions.add(AC_ROOT);
@@ -104,8 +104,12 @@ public class SandalsOfNature extends Artifact {
if ( isEquipped ( Dungeon.hero ) ){ if ( isEquipped ( Dungeon.hero ) ){
desc += "\n\n"; desc += "\n\n";
if (level == 0) if (level == 0) {
desc += "The sandals wrap snugly around your feet, they seem happy to be worn."; if (!cursed)
desc += "The sandals wrap snugly around your feet, they seem happy to be worn.";
else
desc += "The cursed sandals wrap tightly around your feet.";
}
else if (level == 1) else if (level == 1)
desc += "The shoes fit on loosely but quickly tighten to make a perfect fit."; desc += "The shoes fit on loosely but quickly tighten to make a perfect fit.";
else if (level == 2) else if (level == 2)
@@ -113,7 +117,10 @@ public class SandalsOfNature extends Artifact {
else else
desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you."; desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you.";
desc += " You feel more attuned with nature while wearing them."; if (!cursed)
desc += " You feel more attuned with nature while wearing them.";
else
desc += " They are blocking any attunement with nature.";
if (level > 0) if (level > 0)
desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " + desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " +
@@ -153,11 +160,9 @@ public class SandalsOfNature extends Artifact {
} }
public class Naturalism extends ArtifactBuff{ public class Naturalism extends ArtifactBuff{
public int level() { return level; }
public void charge() { public void charge() {
if (charge < 25*level){ if (charge < 25*level){
charge++; charge++;
} }
} }
} }
@@ -5,9 +5,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.CheckedCell;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -16,7 +13,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
@@ -41,7 +37,7 @@ public class TalismanOfForesight extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && charge == 100) if (isEquipped( hero ) && charge == 100 && !cursed)
actions.add(AC_SCRY); actions.add(AC_SCRY);
return actions; return actions;
} }
@@ -90,10 +86,14 @@ public class TalismanOfForesight extends Artifact {
String desc = "A smooth stone, almost too big for your pocket or hand, with strange engravings on it. " + String desc = "A smooth stone, almost too big for your pocket or hand, with strange engravings on it. " +
"You feel like it's watching you, assessing your every move."; "You feel like it's watching you, assessing your every move.";
if ( isEquipped( Dungeon.hero ) ){ if ( isEquipped( Dungeon.hero ) ){
desc += "\n\nWhen you hold the talisman you feel like your senses are heightened."; if (!cursed) {
if (charge == 100) desc += "\n\nWhen you hold the talisman you feel like your senses are heightened.";
desc += "\n\nThe talisman is radiating energy, prodding at your mind. You wonder what would " + if (charge == 100)
"happen if you let it in."; desc += "\n\nThe talisman is radiating energy, prodding at your mind. You wonder what would " +
"happen if you let it in.";
} else {
desc += "\n\nThe cursed talisman is intently staring into you, making it impossible to concentrate.";
}
} }
return desc; return desc;
@@ -137,7 +137,7 @@ public class TalismanOfForesight extends Artifact {
} }
} }
if (smthFound == true){ if (smthFound == true || !cursed){
if (warn == 0){ if (warn == 0){
GLog.w("You feel uneasy."); GLog.w("You feel uneasy.");
if (target instanceof Hero){ if (target instanceof Hero){
@@ -153,7 +153,7 @@ public class TalismanOfForesight extends Artifact {
BuffIndicator.refreshHero(); BuffIndicator.refreshHero();
//fully charges in 2400 turns at lvl=0, scaling to 800 turns at lvl = 10. //fully charges in 2400 turns at lvl=0, scaling to 800 turns at lvl = 10.
if (charge < 100) { if (charge < 100 && !cursed) {
partialCharge += (1f / 24) + (((float) level) / 80); partialCharge += (1f / 24) + (((float) level) / 80);
@@ -17,9 +17,6 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.food; package com.shatteredpixel.shatteredpixeldungeon.items.food;
import java.util.ArrayList;
import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.Statistics;
@@ -28,9 +25,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class Food extends Item { public class Food extends Item {
@@ -100,6 +102,18 @@ public class Food extends Item {
} }
} }
@Override
public boolean doPickUp( Hero hero ){
Artifact.ArtifactBuff buff = hero.buff( HornOfPlenty.hornRecharge.class );
if (buff != null && buff.isCursed()){
GLog.n("Your cursed horn greedily devours the food!");
Sample.INSTANCE.play( Assets.SND_EAT );
hero.spendAndNext( TIME_TO_PICK_UP );
return true;
}
return super.doPickUp( hero );
}
@Override @Override
public String info() { public String info() {
return return
@@ -43,22 +43,29 @@ public class HighGrass {
if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) { if (!Dungeon.isChallenged( Challenges.NO_HERBALISM )) {
int naturalismLevel = 0; int naturalismLevel = 0;
if (ch != null) { if (ch != null) {
SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class );
if (naturalism != null) { if (naturalism != null) {
naturalismLevel = naturalism.level()+1; if (!naturalism.isCursed()) {
naturalism.charge(); naturalismLevel = naturalism.level() + 1;
naturalism.charge();
} else {
naturalismLevel = -1;
}
} }
} }
// Seed if (naturalismLevel >= 0) {
if (Random.Int(18-((int)(naturalismLevel*3.34))) == 0) { // Seed
level.drop( Generator.random( Generator.Category.SEED ), pos ).sprite.drop(); if (Random.Int(18 - ((int) (naturalismLevel * 3.34))) == 0) {
} level.drop(Generator.random(Generator.Category.SEED), pos).sprite.drop();
}
// Dew // Dew
if (Random.Int( 6-naturalismLevel ) == 0) { if (Random.Int(6 - naturalismLevel) == 0) {
level.drop( new Dewdrop(), pos ).sprite.drop(); level.drop(new Dewdrop(), pos).sprite.drop();
}
} }
} }
@@ -171,7 +171,7 @@ public class ItemSlot extends Button {
int level = item.visiblyUpgraded(); int level = item.visiblyUpgraded();
if (level != 0 || (item.cursed && item.cursedKnown)) { if (level != 0) {
bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : "" ); bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : "" );
bottomRight.measure(); bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED ); bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED );