v0.7.4a: Adjustments to wand of warding:

- Wand can now reach through walls, but only to visible locations
- Wand now fizzles if it is at ward capacity
This commit is contained in:
Evan Debenham 2019-07-27 18:06:30 -04:00
parent c49d421810
commit 1d98252ebf
4 changed files with 45 additions and 28 deletions

View File

@ -111,7 +111,7 @@ public abstract class Wand extends Item {
public abstract void onHit( MagesStaff staff, Char attacker, Char defender, int damage); public abstract void onHit( MagesStaff staff, Char attacker, Char defender, int damage);
public boolean tryToZap( Hero owner ){ public boolean tryToZap( Hero owner, int target ){
if (owner.buff(MagicImmune.class) != null){ if (owner.buff(MagicImmune.class) != null){
GLog.w( Messages.get(this, "no_magic") ); GLog.w( Messages.get(this, "no_magic") );
@ -440,7 +440,7 @@ public abstract class Wand extends Item {
else else
QuickSlotButton.target(Actor.findChar(cell)); QuickSlotButton.target(Actor.findChar(cell));
if (curWand.tryToZap(curUser)) { if (curWand.tryToZap(curUser, target)) {
curUser.busy(); curUser.busy();
Invisibility.dispel(); Invisibility.dispel();

View File

@ -15,7 +15,6 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.WardSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.WardSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@ -28,13 +27,15 @@ import com.watabou.utils.Random;
public class WandOfWarding extends Wand { public class WandOfWarding extends Wand {
{ {
collisionProperties = Ballistica.STOP_TARGET | Ballistica.STOP_TERRAIN; collisionProperties = Ballistica.STOP_TARGET;
image = ItemSpriteSheet.WAND_WARDING; image = ItemSpriteSheet.WAND_WARDING;
} }
private boolean wardAvailable = true;
@Override @Override
protected void onZap(Ballistica bolt) { public boolean tryToZap(Hero owner, int target) {
int currentWardEnergy = 0; int currentWardEnergy = 0;
for (Char ch : Actor.chars()){ for (Char ch : Actor.chars()){
@ -52,33 +53,49 @@ public class WandOfWarding extends Wand {
} }
} }
wardAvailable = (currentWardEnergy < maxWardEnergy);
Char ch = Actor.findChar(target);
if (ch instanceof Ward){
if (!wardAvailable && ((Ward) ch).tier <= 3){
GLog.w( Messages.get(this, "no_more_wards"));
return false;
}
} else {
if ((currentWardEnergy + 2) > maxWardEnergy){
GLog.w( Messages.get(this, "no_more_wards"));
return false;
}
}
return super.tryToZap(owner, target);
}
@Override
protected void onZap(Ballistica bolt) {
Char ch = Actor.findChar(bolt.collisionPos); Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null){ if (!curUser.fieldOfView[bolt.collisionPos]){
GLog.w( Messages.get(this, "bad_location"));
} else if (ch != null){
if (ch instanceof Ward){ if (ch instanceof Ward){
if (currentWardEnergy < maxWardEnergy) { if (wardAvailable) {
((Ward) ch).upgrade(level()); ((Ward) ch).upgrade(level());
} else { } else {
if (((Ward) ch).tier <= 3){ ((Ward) ch).wandHeal( level() );
GLog.w( Messages.get(this, "no_more_wards"));
} else {
((Ward) ch).wandHeal( level() );
}
} }
ch.sprite.emitter().burst(MagicMissile.WardParticle.UP, ((Ward) ch).tier); ch.sprite.emitter().burst(MagicMissile.WardParticle.UP, ((Ward) ch).tier);
} else { } else {
GLog.w( Messages.get(this, "bad_location")); GLog.w( Messages.get(this, "bad_location"));
} }
} else if (canPlaceWard(bolt.collisionPos)){ } else if (canPlaceWard(bolt.collisionPos)){
if ((currentWardEnergy + 2) <= maxWardEnergy) { Ward ward = new Ward();
Ward ward = new Ward(); ward.pos = bolt.collisionPos;
ward.pos = bolt.collisionPos; ward.wandLevel = level();
ward.wandLevel = level(); GameScene.add(ward, 1f);
GameScene.add(ward, 1f); Dungeon.level.press(ward.pos, ward);
Dungeon.level.press(ward.pos, ward); ward.sprite.emitter().burst(MagicMissile.WardParticle.UP, ward.tier);
ward.sprite.emitter().burst(MagicMissile.WardParticle.UP, ward.tier);
} else {
GLog.w( Messages.get(this, "no_more_wards"));
}
} else { } else {
GLog.w( Messages.get(this, "bad_location")); GLog.w( Messages.get(this, "bad_location"));
} }

View File

@ -98,7 +98,7 @@ actors.buffs.burning.desc=Few things are more distressing than being engulfed in
actors.buffs.charm.name=Charmed actors.buffs.charm.name=Charmed
actors.buffs.charm.heromsg=You are charmed! actors.buffs.charm.heromsg=You are charmed!
actors.buffs.charm.desc=A charm is manipulative magic that can make enemies temporarily adore eachother.\n\nCharacters affected by charm are unable to directly attack the enemy they are charmed by. Attacking other targets is still possible however. The shock of pain will lessen the duration of charm.\n\nTurns of charm remaining: %s. actors.buffs.charm.desc=A charm is manipulative magic that can make enemies temporarily adore each other.\n\nCharacters affected by charm are unable to directly attack the enemy they are charmed by. Attacking other targets is still possible however. The shock of pain will lessen the duration of charm.\n\nTurns of charm remaining: %s.
actors.buffs.chill.name=Chilled actors.buffs.chill.name=Chilled
actors.buffs.chill.freezes=%s freezes! actors.buffs.chill.freezes=%s freezes!

View File

@ -1218,9 +1218,9 @@ items.wands.wandoftransfusion.stats_desc=When used on allies, this wand saps som
items.wands.wandofwarding.name=wand of warding items.wands.wandofwarding.name=wand of warding
items.wands.wandofwarding.staff_name=staff of warding items.wands.wandofwarding.staff_name=staff of warding
items.wands.wandofwarding.no_more_wards=Your wand can't sustain any more wards. items.wands.wandofwarding.no_more_wards=Your wand can't sustain any more wards.
items.wands.wandofwarding.bad_location=There isn't enough space to place a ward there. items.wands.wandofwarding.bad_location=You can't place a ward there.
items.wands.wandofwarding.desc=This short metal wand has a bright purple gem floating above its tip. items.wands.wandofwarding.desc=This short metal wand has a bright purple gem floating above its tip.
items.wands.wandofwarding.stats_desc=Rather than directly damaging an enemy, this wand will summon stationary wards and sentries. Note that wards cannot be placed next to each other, and this wand can only sustain _%d energy_ worth of wards at a time. items.wands.wandofwarding.stats_desc=Rather than directly damaging an enemy, this wand will summon stationary wards and sentries. Wards can be summoned anywhere you have vision, even through walls, but cannot be placed next to each other. This wand can sustain _%d energy_ worth of wards at a time.
items.wands.wandofwarding$ward.name_1=lesser ward items.wands.wandofwarding$ward.name_1=lesser ward
items.wands.wandofwarding$ward.desc_1=This basic ward will automatically zap any enemy which comes into its range of vision, dealing _%1$d-%2$d damage._\n\nZapping this ward with your wand of warding will upgrade it.\n\nThis ward will only zap a single time before dissipating.\n\nYour wand of warding is using _2 energy_ to sustain this ward. items.wands.wandofwarding$ward.desc_1=This basic ward will automatically zap any enemy which comes into its range of vision, dealing _%1$d-%2$d damage._\n\nZapping this ward with your wand of warding will upgrade it.\n\nThis ward will only zap a single time before dissipating.\n\nYour wand of warding is using _2 energy_ to sustain this ward.
items.wands.wandofwarding$ward.name_2=ward items.wands.wandofwarding$ward.name_2=ward