v0.3.0c: refactored staff visual effects to be contained in wands.
This commit is contained in:
parent
6efa4694b8
commit
c5e9ffa9fe
src/com/shatteredpixel/shatteredpixeldungeon/items
|
@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public abstract class Wand extends Item {
|
||||
|
@ -233,6 +234,14 @@ public abstract class Wand extends Item {
|
|||
Sample.INSTANCE.play( Assets.SND_ZAP );
|
||||
}
|
||||
|
||||
public void staffFx( MagesStaff.StaffParticle particle ){
|
||||
particle.color(0xFFFFFF); particle.am = 0.3f;
|
||||
particle.setLifespan( 1f);
|
||||
particle.speed.polar( Random.Float(PointF.PI2), 2f );
|
||||
particle.setSize( 1f, 2.5f );
|
||||
particle.radiateXY(1f);
|
||||
}
|
||||
|
||||
protected void wandUsed() {
|
||||
usagesToKnow -= cursed ? 1 : chargesPerCast();
|
||||
curCharges -= cursed ? 1 : chargesPerCast();
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.watabou.noosa.Group;
|
|||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
/**
|
||||
|
@ -135,6 +136,15 @@ public class WandOfBlastWave extends Wand {
|
|||
Sample.INSTANCE.play(Assets.SND_ZAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0x664422 ); particle.am = 0.6f;
|
||||
particle.setLifespan(2f);
|
||||
particle.speed.polar(Random.Float(PointF.PI2), 0.3f);
|
||||
particle.setSize( 1f, 2f);
|
||||
particle.radiateXY(3f);
|
||||
}
|
||||
|
||||
public static class BlastWave extends Image {
|
||||
|
||||
private static final float TIME_TO_FADE = 0.2f;
|
||||
|
|
|
@ -91,6 +91,16 @@ public class WandOfCorruption extends Wand {
|
|||
Sample.INSTANCE.play( Assets.SND_ZAP );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0 );
|
||||
particle.am = 0.6f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(0, 40);
|
||||
particle.setSize( 0f, 3f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "This wand radiates dark energy, if that weren't already obvious from the small decorative skull shaped onto its tip.\n" +
|
||||
|
|
|
@ -65,7 +65,7 @@ public class WandOfDisintegration extends Wand {
|
|||
//we don't want to count passed terrain after the last enemy hit. That would be a lot of bonus levels.
|
||||
//terrainPassed starts at 2, equivalent of rounding up when /3 for integer arithmetic.
|
||||
terrainBonus += terrainPassed/3;
|
||||
terrainPassed = 1;
|
||||
terrainPassed = terrainPassed%3;
|
||||
|
||||
chars.add( ch );
|
||||
}
|
||||
|
@ -116,7 +116,17 @@ public class WandOfDisintegration extends Wand {
|
|||
curUser.sprite.parent.add(new Beam.DeathRay(curUser.sprite.center(), DungeonTilemap.tileCenterToWorld( cell )));
|
||||
callback.call();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color(0x220022);
|
||||
particle.am = 0.6f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(40, -40);
|
||||
particle.setSize(0f, 3f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -158,6 +158,16 @@ public class WandOfFireblast extends Wand {
|
|||
return Math.max(1, (int)Math.ceil(curCharges*0.4f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0xEE7722 );
|
||||
particle.am = 0.5f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(0, -40);
|
||||
particle.setSize( 0f, 3f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -78,6 +78,16 @@ public class WandOfFrost extends Wand {
|
|||
new Slow().proc(staff, attacker, defender, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0xFFFFFF );
|
||||
particle.am = 0.5f;
|
||||
particle.setLifespan(1.2f);
|
||||
particle.speed.set(0, Random.Float(5, 8));
|
||||
particle.setSize( 0f, 1f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "This wand seems to be made out of some kind of magical ice. It grows brighter towards its " +
|
||||
|
|
|
@ -129,7 +129,19 @@ public class WandOfLightning extends Wand {
|
|||
curUser.sprite.parent.add( new Lightning( arcs, null ) );
|
||||
callback.call();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color(0xFFFFFF);
|
||||
particle.am = 0.6f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(0, +10);
|
||||
particle.speed.polar(-Random.Float(3.1415926f), 6f);
|
||||
particle.setSize(0f, 1.5f);
|
||||
particle.sizeJitter = 1f;
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -25,6 +25,7 @@ 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.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -139,6 +140,16 @@ public class WandOfPrismaticLight extends Wand {
|
|||
new Paralysis().proc(staff, attacker, defender, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( Random.Int( 0x1000000 ) );
|
||||
particle.am = 0.3f;
|
||||
particle.setLifespan(1f);
|
||||
particle.speed.polar(Random.Float(PointF.PI2), 2f);
|
||||
particle.setSize( 1f, 2.5f);
|
||||
particle.radiateXY(1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -37,8 +37,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.ColorMath;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -222,6 +222,16 @@ public class WandOfRegrowth extends Wand {
|
|||
return Math.max(1, curCharges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( ColorMath.random(0x004400, 0x88CC44) );
|
||||
particle.am = 1f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(0, 40);
|
||||
particle.setSize( 1f, 2f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Callback;
|
||||
import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -207,6 +208,16 @@ public class WandOfTransfusion extends Wand {
|
|||
callback.call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0xCC0000 );
|
||||
particle.am = 0.6f;
|
||||
particle.setLifespan(0.8f);
|
||||
particle.speed.polar( Random.Float(PointF.PI2), 2f );
|
||||
particle.setSize( 1f, 2.5f);
|
||||
particle.radiateXY(1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A fairly plainly shaped wand, it stands out due to its magenta hue and pitch black gem at the tip.\n" +
|
||||
|
|
|
@ -42,6 +42,15 @@ public class WandOfVenom extends Wand {
|
|||
new Poison().proc(staff, attacker, defender, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void staffFx(MagesStaff.StaffParticle particle) {
|
||||
particle.color( 0x8844FF ); particle.am = 0.6f;
|
||||
particle.setLifespan(0.6f);
|
||||
particle.acc.set(0, 40);
|
||||
particle.setSize( 0f, 3f);
|
||||
particle.shuffleXY(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
|
|
|
@ -337,11 +337,11 @@ public class MagesStaff extends MeleeWeapon {
|
|||
};
|
||||
|
||||
//determines particle effects to use based on wand the staff owns.
|
||||
private class StaffParticle extends PixelParticle{
|
||||
public class StaffParticle extends PixelParticle{
|
||||
|
||||
private float minSize;
|
||||
private float maxSize;
|
||||
private float sizeRandomness = 0;
|
||||
public float sizeJitter = 0;
|
||||
|
||||
public StaffParticle(){
|
||||
super();
|
||||
|
@ -355,82 +355,26 @@ public class MagesStaff extends MeleeWeapon {
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
if (wand instanceof WandOfMagicMissile){
|
||||
color(0xFFFFFF); am = 0.3f;
|
||||
lifespan = left = 1f;
|
||||
speed.polar( Random.Float(PointF.PI2), 2f );
|
||||
minSize = 1f; maxSize = 2.5f;
|
||||
radiateXY(1f);
|
||||
} else if (wand instanceof WandOfLightning){
|
||||
color(0xFFFFFF); am = 0.6f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set( 0, +10 ); speed.polar(-Random.Float(3.1415926f), 6f);
|
||||
minSize = 0f; maxSize = 1.5f;
|
||||
sizeRandomness = 1f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfDisintegration){
|
||||
color(0x220022); am = 0.6f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set(40, -40);
|
||||
minSize = 0f; maxSize = 3f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfFireblast) {
|
||||
color( 0xEE7722 ); am = 0.5f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set(0, -40);
|
||||
minSize = 0f; maxSize = 3f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfVenom) {
|
||||
color( 0x8844FF ); am = 0.6f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set(0, 40);
|
||||
minSize = 0f; maxSize = 3f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfBlastWave) {
|
||||
color( 0x664422 ); am = 0.6f;
|
||||
lifespan = left = 2f;
|
||||
speed.polar(Random.Float(PointF.PI2), 0.3f);
|
||||
minSize = 1f; maxSize = 2f;
|
||||
radiateXY(3f);
|
||||
} else if (wand instanceof WandOfFrost) {
|
||||
color( 0xFFFFFF ); am = 0.5f;
|
||||
lifespan = left = 1.2f;
|
||||
speed.set( 0, Random.Float( 5, 8 ) );
|
||||
minSize = 0f; maxSize = 1f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfPrismaticLight) {
|
||||
color( Random.Int( 0x1000000 ) ); am = 0.3f;
|
||||
lifespan = left = 1f;
|
||||
speed.polar(Random.Float(PointF.PI2), 2f);
|
||||
minSize = 1f; maxSize = 2.5f;
|
||||
radiateXY(1f);
|
||||
} else if (wand instanceof WandOfTransfusion) {
|
||||
color( 0xCC0000 ); am = 0.6f;
|
||||
lifespan = left = 0.8f;
|
||||
speed.polar( Random.Float(PointF.PI2), 2f );
|
||||
minSize = 1f; maxSize = 2.5f;
|
||||
radiateXY(1f);
|
||||
} else if (wand instanceof WandOfCorruption) {
|
||||
color( 0 ); am = 0.6f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set(0, 40);
|
||||
minSize = 0f; maxSize = 3f;
|
||||
shuffleXY(2f);
|
||||
} else if (wand instanceof WandOfRegrowth) {
|
||||
color( ColorMath.random(0x004400, 0x88CC44) ); am = 1f;
|
||||
lifespan = left = 0.6f;
|
||||
acc.set(0, 40);
|
||||
minSize = 1f; maxSize = 2f;
|
||||
shuffleXY(2f);
|
||||
}
|
||||
if (wand != null)
|
||||
wand.staffFx( this );
|
||||
|
||||
}
|
||||
|
||||
private void shuffleXY(float amt){
|
||||
public void setSize( float minSize, float maxSize ){
|
||||
this.minSize = minSize;
|
||||
this.maxSize = maxSize;
|
||||
}
|
||||
|
||||
public void setLifespan( float life ){
|
||||
lifespan = left = life;
|
||||
}
|
||||
|
||||
public void shuffleXY(float amt){
|
||||
x += Random.Float(-amt, amt);
|
||||
y += Random.Float(-amt, amt);
|
||||
}
|
||||
|
||||
private void radiateXY(float amt){
|
||||
public void radiateXY(float amt){
|
||||
float hypot = (float)Math.hypot(speed.x, speed.y);
|
||||
this.x += speed.x/hypot*amt;
|
||||
this.y += speed.y/hypot*amt;
|
||||
|
@ -439,7 +383,7 @@ public class MagesStaff extends MeleeWeapon {
|
|||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
size(minSize + (left / lifespan)*(maxSize-minSize) + Random.Float(sizeRandomness));
|
||||
size(minSize + (left / lifespan)*(maxSize-minSize) + Random.Float(sizeJitter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user