V0.2.0: Added Cape of Thorns

This commit is contained in:
Evan Debenham 2014-09-03 14:39:15 -04:00
parent 93b5fe3eb6
commit 33b015a25e
4 changed files with 114 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,113 @@
package com.shatteredpixel.shatteredpixeldungeon.items.artifacts;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.utils.Random;
/**
* Created by debenhame on 03/09/2014.
*/
public class CapeOfThorns extends Artifact {
//TODO: add polish, testing
{
name = "Cape of Thorns";
image = ItemSpriteSheet.ARTIFACT_CAPE;
level = 0;
levelCap = 10;
charge = 0;
chargeCap = 100;
//partialcharge is unused
}
private int timer = 0;
private int exp = 0;
@Override
public String status() {
if (timer == 0)
return Utils.format("%d%", charge);
else
return Utils.format("%d", timer);
}
@Override
protected ArtifactBuff passiveBuff() {
return new Thorns();
}
@Override
public String desc() {
//TODO: add description
return "";
}
public class Thorns extends ArtifactBuff{
@Override
public boolean act(){
if (timer > 0)
timer--;
else if (charge > 0)
charge--;
return true;
}
public int proc(int damage, Char attacker){
if (timer == 0){
charge += damage/(4f - level*0.1);
if (charge > chargeCap){
charge = 0;
timer = 5+level;
}
}
if (timer != 0){
int deflected = Random.NormalIntRange(0, (int)(damage*0.66));
damage -= deflected;
attacker.damage(deflected, this);
exp+= deflected;
if (exp >= (level+1)*10 && level < levelCap){
exp -= (level+1)*10;
level++;
GLog.p("Your Cape grows stronger!");
}
}
return damage;
}
@Override
public String toString() {
return "Thorns";
}
@Override
public int icon() {
if (timer == 0)
return BuffIndicator.NONE;
else
return BuffIndicator.THORNS;
}
@Override
public void detach(){
timer = 0;
charge = 0;
}
}
}

View File

@ -64,6 +64,7 @@ public class BuffIndicator extends Component {
public static final int DEFERRED = 28; public static final int DEFERRED = 28;
public static final int DROWSY = 29; public static final int DROWSY = 29;
public static final int MAGIC_SLEEP = 30; public static final int MAGIC_SLEEP = 30;
public static final int THORNS = 31;
public static final int SIZE = 7; public static final int SIZE = 7;