v0.4.1: refactoring and description changes to wands

This commit is contained in:
Evan Debenham
2016-07-09 21:30:03 -04:00
committed by Evan Debenham
parent 025783f781
commit 30f259f883
12 changed files with 186 additions and 40 deletions
@@ -255,7 +255,7 @@ public class Generator {
WandOfTransfusion.class,
WandOfCorruption.class,
WandOfRegrowth.class };
Category.WAND.probs = new float[]{ 4, 4, 4, 4, 4, 3, /*3,*/ 3, 3, /*3,*/ 3, 3, 3 };
Category.WAND.probs = new float[]{ 5, 4, 4, 4, 4, 3, /*3,*/ 3, 3, /*3,*/ 3, 3, 3 };
//see generator.randomWeapon
Category.WEAPON.classes = new Class<?>[]{};
@@ -0,0 +1,57 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2016 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.wands;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Random;
//for wands that directly damage a target
//wands with AOE effects count here (e.g. fireblast), but wands with indrect damage do not (e.g. venom, transfusion)
public abstract class DamageWand extends Wand{
public int min(){
return min(level());
}
public abstract int min(int lvl);
public int max(){
return max(level());
}
public abstract int max(int lvl);
public int damageRoll(){
return Random.NormalIntRange(min(), max());
}
public int damageRoll(int lvl){
return Random.NormalIntRange(min(lvl), max(lvl));
}
@Override
public String statsDesc() {
if (levelKnown)
return Messages.get(this, "stats_desc", min(), max());
else
return Messages.get(this, "stats_desc", min(0), max(0));
}
}
@@ -163,10 +163,19 @@ public abstract class Wand extends Item {
@Override
public String info() {
return (cursed && cursedKnown) ?
desc() + "\n\n" + Messages.get(Wand.class, "cursed") :
desc();
String desc = desc();
desc += "\n\n" + statsDesc();
if (cursed && cursedKnown)
desc += "\n\n" + Messages.get(Wand.class, "cursed");
return desc;
}
public String statsDesc(){
return Messages.get(this, "stats_desc");
};
@Override
public boolean isIdentified() {
@@ -43,7 +43,7 @@ import com.watabou.utils.Callback;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class WandOfBlastWave extends Wand {
public class WandOfBlastWave extends DamageWand {
{
image = ItemSpriteSheet.WAND_BLAST_WAVE;
@@ -51,12 +51,20 @@ public class WandOfBlastWave extends Wand {
collisionProperties = Ballistica.PROJECTILE;
}
public int min(int lvl){
return 1+lvl;
}
public int max(int lvl){
return 5+3*lvl;
}
@Override
protected void onZap(Ballistica bolt) {
Sample.INSTANCE.play( Assets.SND_BLAST );
BlastWave.blast(bolt.collisionPos);
int damage = Random.NormalIntRange(1 + level(), 5+3*level());
int damage = damageRoll();
//presses all tiles in the AOE first
for (int i : Level.NEIGHBOURS9){
@@ -38,13 +38,22 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
public class WandOfDisintegration extends Wand {
public class WandOfDisintegration extends DamageWand {
{
image = ItemSpriteSheet.WAND_DISINTEGRATION;
collisionProperties = Ballistica.WONT_STOP;
}
public int min(int lvl){
return 2+lvl;
}
public int max(int lvl){
return 8+4*lvl;
}
@Override
protected void onZap( Ballistica beam ) {
@@ -90,11 +99,9 @@ public class WandOfDisintegration extends Wand {
}
int lvl = level + chars.size() + terrainBonus;
int dmgMin = 2 + lvl;
int dmgMax = 8 + 4*lvl;
for (Char ch : chars) {
processSoulMark(ch, chargesPerCast());
ch.damage( Random.NormalIntRange( dmgMin, dmgMax ), this );
ch.damage( damageRoll(lvl), this );
ch.sprite.centerEmitter().burst( PurpleParticle.BURST, Random.IntRange( 1, 2 ) );
ch.sprite.flash();
}
@@ -34,15 +34,15 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Blazin
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Callback;
import com.watabou.utils.Random;
import java.util.HashSet;
public class WandOfFireblast extends Wand {
public class WandOfFireblast extends DamageWand {
{
image = ItemSpriteSheet.WAND_FIREBOLT;
@@ -50,6 +50,16 @@ public class WandOfFireblast extends Wand {
collisionProperties = Ballistica.STOP_TERRAIN;
}
//1x/1.5x/2.25x damage
public int min(int lvl){
return (int)Math.round((1+lvl) * Math.pow(1.5f, chargesPerCast()-1));
}
//1x/1.5x/2.25x damage
public int max(int lvl){
return (int)Math.round((5+3*lvl) * Math.pow(1.5f, chargesPerCast()-1));
}
//the actual affected cells
private HashSet<Integer> affectedCells;
//the cells to trace fire shots to, for visual effects.
@@ -68,11 +78,7 @@ public class WandOfFireblast extends Wand {
Char ch = Actor.findChar( cell );
if (ch != null) {
int min = 1+level();
int max = Math.round(5 + 3*level());
//1x/1.5x/2.25x damage
int damage = (int)Math.round(Random.NormalIntRange(min, max) * Math.pow(1.5f, chargesPerCast()-1));
int damage = damageRoll();
ch.damage(damage, this);
Buff.affect( ch, Burning.class ).reignite( ch );
@@ -165,6 +171,14 @@ public class WandOfFireblast extends Wand {
return Math.max(1, (int)Math.ceil(curCharges*0.3f));
}
@Override
public String statsDesc() {
if (levelKnown)
return Messages.get(this, "stats_desc", chargesPerCast(), min(), max());
else
return Messages.get(this, "stats_desc", chargesPerCast(), min(0), max(0));
}
@Override
public void staffFx(MagesStaff.StaffParticle particle) {
particle.color( 0xEE7722 );
@@ -39,12 +39,20 @@ import com.watabou.utils.Callback;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class WandOfFrost extends Wand {
public class WandOfFrost extends DamageWand {
{
image = ItemSpriteSheet.WAND_FROST;
}
public int min(int lvl){
return 2+lvl;
}
public int max(int lvl){
return 8+5*lvl;
}
@Override
protected void onZap(Ballistica bolt) {
@@ -56,7 +64,7 @@ public class WandOfFrost extends Wand {
Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null){
int damage = Random.NormalIntRange(5+level(), 10+5*level());
int damage = damageRoll();
if (ch.buff(Frost.class) != null){
return; //do nothing, can't affect a frozen target
@@ -40,7 +40,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList;
public class WandOfLightning extends Wand {
public class WandOfLightning extends DamageWand {
{
image = ItemSpriteSheet.WAND_LIGHTNING;
@@ -49,6 +49,14 @@ public class WandOfLightning extends Wand {
private ArrayList<Char> affected = new ArrayList<>();
ArrayList<Lightning.Arc> arcs = new ArrayList<>();
public int min(int lvl){
return 5+lvl;
}
public int max(int lvl){
return 10+5*lvl;
}
@Override
protected void onZap( Ballistica bolt ) {
@@ -63,7 +71,7 @@ public class WandOfLightning extends Wand {
for (Char ch : affected){
processSoulMark(ch, chargesPerCast());
ch.damage(Math.round(Random.NormalIntRange(min, max) * multipler), LightningTrap.LIGHTNING);
ch.damage(Math.round(damageRoll() * multipler), LightningTrap.LIGHTNING);
if (ch == Dungeon.hero) Camera.main.shake( 2, 0.3f );
ch.sprite.centerEmitter().burst( SparkParticle.FACTORY, 3 );
@@ -28,13 +28,20 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
public class WandOfMagicMissile extends Wand {
public class WandOfMagicMissile extends DamageWand {
{
image = ItemSpriteSheet.WAND_MAGIC_MISSILE;
}
public int min(int lvl){
return 2+lvl;
}
public int max(int lvl){
return 8+2*lvl;
}
@Override
protected void onZap( Ballistica bolt ) {
@@ -43,7 +50,7 @@ public class WandOfMagicMissile extends Wand {
if (ch != null) {
processSoulMark(ch, chargesPerCast());
ch.damage(Random.NormalIntRange(2 + level() , 8 + level() * 2), this);
ch.damage(damageRoll(), this);
ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2);
@@ -46,7 +46,7 @@ import com.watabou.utils.Callback;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class WandOfPrismaticLight extends Wand {
public class WandOfPrismaticLight extends DamageWand {
{
image = ItemSpriteSheet.WAND_PRISMATIC_LIGHT;
@@ -54,6 +54,14 @@ public class WandOfPrismaticLight extends Wand {
collisionProperties = Ballistica.MAGIC_BOLT;
}
public int min(int lvl){
return 1+lvl;
}
public int max(int lvl){
return 5+3*lvl;
}
@Override
protected void onZap(Ballistica beam) {
Char ch = Actor.findChar(beam.collisionPos);
@@ -68,7 +76,7 @@ public class WandOfPrismaticLight extends Wand {
}
private void affectTarget(Char ch){
int dmg = Random.NormalIntRange(1+level(), 5+3*level());
int dmg = damageRoll();
//three in (5+lvl) chance of failing
if (Random.Int(5+level()) >= 3) {
@@ -237,6 +237,8 @@ public class MagesStaff extends MeleeWeapon {
if (wand == null){
info += "\n\n" + Messages.get(this, "no_wand");
} else {
info += "\n\n" + Messages.get(this, "has_wand", Messages.get(wand, "name")) + " " + wand.statsDesc();
}
return info;
@@ -286,9 +288,15 @@ public class MagesStaff extends MeleeWeapon {
if (wand == null){
applyWand((Wand)item);
} else {
final int newLevel =
item.level() >= level() ?
level() > 0 ?
item.level() + 1
: item.level()
: level();
GameScene.show(
new WndOptions("",
Messages.get(MagesStaff.class, "warning"),
Messages.get(MagesStaff.class, "warning", newLevel),
Messages.get(MagesStaff.class, "yes"),
Messages.get(MagesStaff.class, "no")) {
@Override