Merging Source v1.7.2: item changes

This commit is contained in:
Evan Debenham
2014-10-21 00:38:15 -04:00
parent 4a49763309
commit 13afc9df8d
32 changed files with 523 additions and 269 deletions
@@ -37,7 +37,6 @@ import com.watabou.utils.Random;
public class Armor extends EquipableItem {
private static final String TXT_EQUIP_CURSED = "your %s constricts around you painfully";
private static final String TXT_UNEQUIP_CURSED = "You can't remove cursed %s!";
private static final String TXT_IDENTIFY = "you are now familiar enough with your %s to identify it. It is %s.";
@@ -89,7 +88,7 @@ public class Armor extends EquipableItem {
detach( hero.belongings.backpack );
if (hero.belongings.armor == null || hero.belongings.armor.doUnequip( hero, true )) {
if (hero.belongings.armor == null || hero.belongings.armor.doUnequip( hero, true, false )) {
hero.belongings.armor = this;
@@ -100,8 +99,8 @@ public class Armor extends EquipableItem {
}
((HeroSprite)hero.sprite).updateArmor();
hero.spendAndNext( 2 * hero.speed() );
hero.spendAndNext( 2 * time2equip( hero ) );
return true;
} else {
@@ -111,29 +110,27 @@ public class Armor extends EquipableItem {
}
}
@Override
public boolean doUnequip( Hero hero, boolean collect ) {
if (cursed) {
GLog.w( TXT_UNEQUIP_CURSED, name() );
return false;
} else {
hero.belongings.armor = null;
hero.spendAndNext( hero.speed() );
((HeroSprite)hero.sprite).updateArmor();
if (collect && !collect( hero.belongings.backpack )) {
Dungeon.level.drop( this, hero.pos );
}
return true;
}
}
@Override
protected float time2equip( Hero hero ) {
return hero.speed();
}
@Override
public boolean doUnequip( Hero hero, boolean collect, boolean single ) {
if (super.doUnequip( hero, collect, single )) {
hero.belongings.armor = null;
((HeroSprite)hero.sprite).updateArmor();
return true;
} else {
return false;
}
}
@Override
public boolean isEquipped( Hero hero ) {
@@ -305,11 +302,19 @@ public class Armor extends EquipableItem {
}
return price;
}
public Armor inscribe( Glyph glyph ) {
this.glyph = glyph;
return this;
}
public Armor inscribe( Glyph glyph ) {
if (glyph != null && this.glyph == null) {
DR += tier;
} else if (glyph == null && this.glyph != null) {
DR -= tier;
}
this.glyph = glyph;
return this;
}
public boolean isInscribed() {
return glyph != null;
@@ -85,7 +85,7 @@ abstract public class ClassArmor extends Armor {
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (hero.HP >= 2 && isEquipped( hero )) {
if (hero.HP >= 3 && isEquipped( hero )) {
actions.add( special() );
}
return actions;
@@ -95,7 +95,7 @@ abstract public class ClassArmor extends Armor {
public void execute( Hero hero, String action ) {
if (action == special()) {
if (hero.HP < 2) {
if (hero.HP < 3) {
GLog.w( TXT_LOW_HEALTH );
} else if (!isEquipped( hero )) {
GLog.w( TXT_NOT_EQUIPPED );
@@ -81,7 +81,7 @@ public class HuntressArmor extends ClassArmor {
return;
}
curUser.HP /= 2;
curUser.HP -= (curUser.HP / 3);
curUser.sprite.zap( curUser.pos );
curUser.busy();
@@ -64,8 +64,8 @@ public class MageArmor extends ClassArmor {
Buff.prolong( mob, Roots.class, 3 );
}
}
curUser.HP /= 2;
curUser.HP -= (curUser.HP / 3);
curUser.spend( Actor.TICK );
curUser.sprite.operate( curUser.pos );
@@ -26,7 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob.State;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlink;
@@ -88,13 +87,13 @@ public class RogueArmor extends ClassArmor {
GLog.w( TXT_FOV );
return;
}
curUser.HP /= 2;
curUser.HP -= (curUser.HP / 3);
for (Mob mob : Dungeon.level.mobs) {
if (Level.fieldOfView[mob.pos]) {
Buff.prolong( mob, Blindness.class, 2 );
mob.state = State.WANDERING;
mob.state = mob.WANDERING;
mob.sprite.emitter().burst( Speck.factory( Speck.LIGHT ), 4 );
}
}
@@ -17,8 +17,8 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.items.armor;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.watabou.noosa.Camera;
import com.watabou.noosa.tweeners.PosTweener;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@@ -37,8 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.PointF;
import com.watabou.utils.Callback;
public class WarriorArmor extends ClassArmor {
private static int LEAP_TIME = 1;
@@ -90,34 +89,36 @@ public class WarriorArmor extends ClassArmor {
if (Actor.findChar( cell ) != null && cell != curUser.pos) {
cell = Ballistica.trace[Ballistica.distance - 2];
}
curUser.HP /= 2;
curUser.HP -= (curUser.HP / 3);
if (curUser.subClass == HeroSubClass.BERSERKER && curUser.HP <= curUser.HT * Fury.LEVEL) {
Buff.affect( curUser, Fury.class );
}
Invisibility.dispel();
curUser.move( cell );
curUser.sprite.place( cell );
Dungeon.level.press( target, curUser );
Dungeon.observe();
for (int i=0; i < Level.NEIGHBOURS8.length; i++) {
Char mob = Actor.findChar( curUser.pos + Level.NEIGHBOURS8[i] );
if (mob != null && mob != curUser) {
Buff.prolong( mob, Paralysis.class, SHOCK_TIME );
}
}
PointF pos = curUser.sprite.point();
Camera.main.target = null;
curUser.sprite.y -= 16;
curUser.sprite.parent.add( new PosTweener( curUser.sprite, pos, 0.1f ) );
CellEmitter.center( cell ).burst( Speck.factory( Speck.DUST ), 10 );
curUser.spendAndNext( LEAP_TIME );
final int dest = cell;
curUser.busy();
((HeroSprite)curUser.sprite).jump(curUser.pos, cell, new Callback() {
@Override
public void call() {
curUser.move(dest);
Dungeon.level.press(dest, curUser);
Dungeon.observe();
for (int i = 0; i < Level.NEIGHBOURS8.length; i++) {
Char mob = Actor.findChar(curUser.pos + Level.NEIGHBOURS8[i]);
if (mob != null && mob != curUser) {
Buff.prolong(mob, Paralysis.class, SHOCK_TIME);
}
}
CellEmitter.center(dest).burst(Speck.factory(Speck.DUST), 10);
Camera.main.shake(2, 0.5f);
curUser.spendAndNext(LEAP_TIME);
}
});
}
}
@@ -47,7 +47,7 @@ public class Bounce extends Glyph {
Actor.addDelayed( new Pushing( attacker, attacker.pos, newPos ), -1 );
attacker.pos = newPos;
// :(
// FIXME
if (attacker instanceof Mob) {
Dungeon.level.mobPress( (Mob)attacker );
} else {
@@ -125,7 +125,7 @@ public class Viscosity extends Glyph {
target.damage( 1, this );
if (target == Dungeon.hero && !target.isAlive()) {
// Refactoring needed!
// FIXME
Glyph glyph = new Viscosity();
Dungeon.fail( Utils.format( ResultDescriptions.GLYPH, glyph.name(), Dungeon.depth ) );
GLog.n( "%s killed you...", glyph.name() );