v0.3.0c: refactored plants to match the structure of new traps.
This commit is contained in:
@@ -290,8 +290,8 @@ public class Wandmaker extends NPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
GameScene.add( Blob.seed( pos, 100, ToxicGas.class ) );
|
||||
|
||||
|
||||
@@ -253,8 +253,7 @@ public class WandOfRegrowth extends Wand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Char ch) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
|
||||
int nDrops = Random.NormalIntRange(2, 8);
|
||||
|
||||
@@ -295,8 +294,7 @@ public class WandOfRegrowth extends Wand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Char ch) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
|
||||
int nSeeds = Random.NormalIntRange(1, 5);
|
||||
|
||||
|
||||
@@ -819,7 +819,7 @@ public abstract class Level implements Bundlable {
|
||||
|
||||
Plant plant = plants.get( cell );
|
||||
if (plant != null) {
|
||||
plant.activate( ch );
|
||||
plant.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ public abstract class Level implements Bundlable {
|
||||
|
||||
Plant plant = plants.get( cell );
|
||||
if (plant != null) {
|
||||
plant.activate( mob );
|
||||
plant.trigger();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
@@ -20,8 +21,8 @@ public class BlandfruitBush extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
@@ -41,8 +42,8 @@ public class Blindweed extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch != null) {
|
||||
int len = Random.Int( 5, 10 );
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
@@ -46,8 +47,8 @@ public class Dreamfoil extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch != null) {
|
||||
if (ch instanceof Mob)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
@@ -41,8 +42,8 @@ public class Earthroot extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch == Dungeon.hero) {
|
||||
Buff.affect( ch, Armor.class ).level = ch.HT;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
@@ -39,8 +40,8 @@ public class Fadeleaf extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch instanceof Hero) {
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
@@ -37,8 +36,7 @@ public class Firebloom extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
|
||||
GameScene.add( Blob.seed( pos, 2, Fire.class ) );
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Freezing;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfFrost;
|
||||
@@ -39,8 +38,7 @@ public class Icecap extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
|
||||
PathFinder.buildDistanceMap( pos, BArray.not( Level.losBlocking, null ), 1 );
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
@@ -41,7 +42,7 @@ import com.watabou.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class Plant implements Bundlable {
|
||||
public abstract class Plant implements Bundlable {
|
||||
|
||||
public String plantName;
|
||||
|
||||
@@ -49,16 +50,21 @@ public class Plant implements Bundlable {
|
||||
public int pos;
|
||||
|
||||
public PlantSprite sprite;
|
||||
|
||||
public void activate( Char ch ) {
|
||||
|
||||
|
||||
public void trigger(){
|
||||
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch instanceof Hero && ((Hero)ch).subClass == HeroSubClass.WARDEN) {
|
||||
Buff.affect( ch, Barkskin.class ).level( ch.HT / 3 );
|
||||
}
|
||||
|
||||
|
||||
activate();
|
||||
wither();
|
||||
}
|
||||
|
||||
public abstract void activate();
|
||||
|
||||
public void wither() {
|
||||
Dungeon.level.uproot( pos );
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
|
||||
@@ -37,8 +38,8 @@ public class Sorrowmoss extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch != null) {
|
||||
Buff.affect( ch, Poison.class ).set( Poison.durationFactor( ch ) * (4 + Dungeon.depth / 2) );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
@@ -20,8 +21,8 @@ public class Starflower extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Char ch) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch != null) Buff.prolong(ch, Bless.class, 30f);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
|
||||
@@ -21,8 +22,8 @@ public class Stormvine extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch != null) {
|
||||
Buff.affect(ch, Vertigo.class, Vertigo.duration( ch ) );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.plants;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
@@ -39,8 +40,8 @@ public class Sungrass extends Plant {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate( Char ch ) {
|
||||
super.activate( ch );
|
||||
public void activate() {
|
||||
Char ch = Actor.findChar(pos);
|
||||
|
||||
if (ch == Dungeon.hero) {
|
||||
Buff.affect( ch, Health.class ).level = ch.HT;
|
||||
|
||||
Reference in New Issue
Block a user