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