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

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.staff_name=staff of warding
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.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.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