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
@@ -1,12 +1,15 @@
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
import java.util.ArrayList;
@@ -14,10 +17,6 @@ import java.util.ArrayList;
* Created by Evan on 24/08/2014.
*/
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;
@@ -83,6 +82,13 @@ public class Artifact extends KindofMisc {
activate( hero );
cursedKnown = true;
identify();
if (cursed) {
equipCursed( hero );
GLog.n( "the " + this.name + " painfully binds itself to you" );
}
hero.spendAndNext( TIME_TO_EQUIP );
return true;
@@ -133,14 +139,22 @@ public class Artifact extends KindofMisc {
}
@Override
public boolean isIdentified() {
return true;
public String info() {
if (cursed && cursedKnown && !isEquipped( Dungeon.hero )) {
return desc() + "\n\nYou can feel a malevolent magic lurking within the " + name() + ".";
} else {
return desc();
}
}
@Override
public String toString() {
if (levelKnown && level != 0) {
if (levelKnown && level/levelCap != 0) {
if (chargeCap > 0) {
return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap );
} 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() {
return null;
}
@@ -163,6 +200,14 @@ public class Artifact extends KindofMisc {
public class ArtifactBuff extends Buff {
public int level() {
return level;
}
public boolean isCursed() {
return cursed;
}
}
private static final String IMAGE = "image";
@@ -187,18 +232,4 @@ public class Artifact extends KindofMisc {
charge = bundle.getInt( CHARGE );
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;
}
}