v0.4.0: implemented new glyphs

This commit is contained in:
Evan Debenham
2016-06-04 21:54:37 -04:00
parent 14a8fbdd63
commit 6172b46175
23 changed files with 568 additions and 177 deletions
@@ -27,9 +27,11 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Thief;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Brimstone;
import com.shatteredpixel.shatteredpixeldungeon.items.food.ChargrilledMeat;
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
@@ -44,8 +46,6 @@ import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Burning extends Buff implements Hero.Doom {
private static final String TXT_BURNS_UP = "%s burns up!";
private static final float DURATION = 8f;
@@ -76,37 +76,55 @@ public class Burning extends Buff implements Hero.Doom {
//maximum damage scales from 6 to 2 depending on remaining hp.
int maxDmg = 3 + Math.round( 4 * target.HP / (float)target.HT );
target.damage( Random.Int( 1, maxDmg ), this );
int damage = Random.Int( 1, maxDmg );
Buff.detach( target, Chill.class);
if (target instanceof Hero) {
Hero hero = (Hero)target;
Item item = hero.belongings.randomUnequipped();
if (item instanceof Scroll) {
item = item.detach( hero.belongings.backpack );
GLog.w( Messages.get(this, "burnsup", Messages.capitalize(item.toString())) );
Heap.burnFX( hero.pos );
} else if (item instanceof MysteryMeat) {
item = item.detach( hero.belongings.backpack );
ChargrilledMeat steak = new ChargrilledMeat();
if (!steak.collect( hero.belongings.backpack )) {
Dungeon.level.drop( steak, hero.pos ).sprite.drop();
if (hero.belongings.armor != null && hero.belongings.armor.glyph != null
&& hero.belongings.armor.glyph instanceof Brimstone){
int heal = hero.belongings.armor.level()/2;
if (heal > 0 && hero.HP < hero.HT) {
hero.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
hero.HP = Math.min(hero.HT, hero.HP + heal);
}
GLog.w( Messages.get(this, "burnsup", item.toString()) );
Heap.burnFX( hero.pos );
} else {
hero.damage( damage, this );
Item item = hero.belongings.randomUnequipped();
if (item instanceof Scroll) {
item = item.detach( hero.belongings.backpack );
GLog.w( Messages.get(this, "burnsup", Messages.capitalize(item.toString())) );
Heap.burnFX( hero.pos );
} else if (item instanceof MysteryMeat) {
item = item.detach( hero.belongings.backpack );
ChargrilledMeat steak = new ChargrilledMeat();
if (!steak.collect( hero.belongings.backpack )) {
Dungeon.level.drop( steak, hero.pos ).sprite.drop();
}
GLog.w( Messages.get(this, "burnsup", item.toString()) );
Heap.burnFX( hero.pos );
}
}
} else if (target instanceof Thief && ((Thief)target).item instanceof Scroll) {
((Thief)target).item = null;
target.sprite.emitter().burst( ElmoParticle.FACTORY, 6 );
} else {
target.damage( damage, this );
}
if (target instanceof Thief && ((Thief)target).item instanceof Scroll) {
((Thief)target).item = null;
target.sprite.emitter().burst( ElmoParticle.FACTORY, 6 );
}
} else {
@@ -221,39 +221,12 @@ public class Belongings implements Iterable<Item> {
}
}
public int charge( boolean full) {
public int charge( float charge ) {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand)item;
if (wand.curCharges < wand.maxCharges) {
wand.curCharges = full ? wand.maxCharges : wand.curCharges + 1;
count++;
wand.updateQuickslot();
}
}
}
return count;
}
public int discharge() {
int count = 0;
for (Item item : this) {
if (item instanceof Wand) {
Wand wand = (Wand)item;
if (wand.curCharges > 0) {
wand.curCharges--;
count++;
wand.updateQuickslot();
}
}
for (Wand.Charger charger : owner.buffs(Wand.Charger.class)){
charger.gainCharge(charge);
}
return count;
@@ -54,6 +54,11 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@@ -286,12 +291,15 @@ public class Hero extends Char {
if (aEnc > 0) {
return (int)(defenseSkill * evasion / Math.pow( 1.5, aEnc ));
} else {
if (heroClass == HeroClass.ROGUE) {
return (int)((defenseSkill - aEnc) * evasion);
} else {
return (int)(defenseSkill * evasion);
}
bonus = 0;
if (heroClass == HeroClass.ROGUE) bonus += -aEnc;
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof Swiftness)
bonus += belongings.armor.level()*2;
return Math.round((defenseSkill + bonus) * evasion);
}
}
@@ -344,8 +352,19 @@ public class Hero extends Char {
if (hasteLevel != 0)
speed *= Math.pow(1.2, hasteLevel);
Armor armor = belongings.armor;
if (armor != null && armor.glyph != null){
if (armor.glyph instanceof Swiftness) {
speed *= (1.1f + 0.01f * belongings.armor.level());
} else if (armor.glyph instanceof Flow && Level.water[pos]){
speed *= (1.5f + 0.05f * belongings.armor.level());
}
}
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 0;
int aEnc = armor != null ? armor.STRReq() - STR() : 0;
if (aEnc > 0) {
return (float)(speed / Math.pow( 1.2, aEnc ));
@@ -938,6 +957,12 @@ public class Hero extends Char {
if (tenacity != 0) //(HT - HP)/HT = heroes current % missing health.
dmg = (int)Math.ceil((float)dmg * Math.pow(0.9, tenacity*((float)(HT - HP)/HT)));
//TODO improve this when I have proper damage source logic
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof AntiMagic && RingOfElements.FULL.contains(src.getClass())){
dmg -= Random.IntRange(0, belongings.armor.DR()/2);
}
super.damage( dmg, src );
}
@@ -1210,6 +1235,10 @@ public class Hero extends Char {
for (Buff buff : buffs( RingOfEvasion.Evasion.class )) {
stealth += ((RingOfEvasion.Evasion)buff).effectiveLevel;
}
if (belongings.armor != null && belongings.armor.glyph != null
&& belongings.armor.glyph instanceof Obfuscation){
stealth += belongings.armor.level();
}
return stealth;
}