v0.7.1: added special plant effects for warden

This commit is contained in:
Evan Debenham 2018-11-30 13:14:57 -05:00
parent a14dcf4a35
commit 9f8b66cdf0
19 changed files with 166 additions and 56 deletions

View File

@ -363,7 +363,9 @@ public class Dungeon {
@SuppressWarnings("deprecation")
public static void switchLevel( final Level level, int pos ) {
if (pos < 0 || pos >= level.length()){
if (pos == -2){
pos = level.exit;
} else if (pos < 0 || pos >= level.length()){
pos = level.entrance;
}

View File

@ -32,11 +32,12 @@ public class AdrenalineSurge extends Buff {
}
private int boost;
private static final float INTERVAL = TICK * 800f;
private float interval;
public void reset(){
boost = 2;
spend(INTERVAL - cooldown());
public void reset(int boost, float interval){
this.boost = boost;
this.interval = interval;
spend(interval - cooldown());
}
public int boost(){
@ -47,7 +48,7 @@ public class AdrenalineSurge extends Buff {
public boolean act() {
boost --;
if (boost > 0){
spend( INTERVAL );
spend( interval );
} else {
detach();
}
@ -70,16 +71,24 @@ public class AdrenalineSurge extends Buff {
}
private static final String BOOST = "boost";
private static final String INTERVAL = "interval";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( BOOST, boost );
bundle.put( INTERVAL, interval );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
boost = bundle.getInt( BOOST );
//pre-0.7.1
if (bundle.contains(INTERVAL)) {
interval = bundle.getFloat(INTERVAL);
} else {
interval = 800f;
}
}
}

View File

@ -22,6 +22,8 @@
package com.shatteredpixel.shatteredpixeldungeon.items.armor.curses;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
@ -48,7 +50,16 @@ public class Overgrowth extends Armor.Glyph {
Plant p = s.couch(defender.pos, null);
p.activate();
//momentarily revoke warden benefits, otherwise this curse would be incredibly powerful
if (defender instanceof Hero && ((Hero) defender).subClass == HeroSubClass.WARDEN){
((Hero) defender).subClass = HeroSubClass.NONE;
p.activate( defender );
((Hero) defender).subClass = HeroSubClass.WARDEN;
} else {
p.activate( defender );
}
CellEmitter.get( defender.pos ).burst( LeafParticle.LEVEL_SPECIFIC, 10 );
}

View File

@ -34,7 +34,7 @@ public class PotionOfAdrenalineSurge extends ExoticPotion {
@Override
public void apply(Hero hero) {
setKnown();
Buff.affect(hero, AdrenalineSurge.class).reset();
Buff.affect(hero, AdrenalineSurge.class).reset(2, 800f);
}
}

View File

@ -300,7 +300,7 @@ public class WandOfRegrowth extends Wand {
}
@Override
public void activate() {
public void activate( Char ch ) {
int nDrops = Random.NormalIntRange(3, 6);
@ -336,7 +336,7 @@ public class WandOfRegrowth extends Wand {
}
@Override
public void activate() {
public void activate( Char ch ) {
int nSeeds = Random.NormalIntRange(2, 4);

View File

@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -32,7 +33,7 @@ public class BlandfruitBush extends Plant {
}
@Override
public void activate() {
public void activate( Char ch ) {
Dungeon.level.drop( new Blandfruit(), pos ).sprite.drop();
}

View File

@ -22,11 +22,13 @@
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.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
@ -40,10 +42,12 @@ public class Blindweed extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch != null) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, Invisibility.class, 10f);
} else {
int len = Random.Int(5, 10);
Buff.prolong(ch, Blindness.class, len);
Buff.prolong(ch, Cripple.class, len);
@ -52,6 +56,7 @@ public class Blindweed extends Plant {
((Mob) ch).beckon(Dungeon.level.randomDestination());
}
}
}
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).burst( Speck.factory( Speck.LIGHT ), 4 );

View File

@ -21,9 +21,9 @@
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.BlobImmunity;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Drowsy;
@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Weakness;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -45,13 +46,12 @@ public class Dreamfoil extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch != null) {
if (ch instanceof Mob)
if (ch instanceof Mob) {
Buff.affect(ch, MagicalSleep.class);
else if (ch instanceof Hero){
} else if (ch instanceof Hero){
GLog.i( Messages.get(this, "refreshed") );
Buff.detach( ch, Poison.class );
Buff.detach( ch, Cripple.class );
@ -60,6 +60,11 @@ public class Dreamfoil extends Plant {
Buff.detach( ch, Drowsy.class );
Buff.detach( ch, Slow.class );
Buff.detach( ch, Vertigo.class);
if (((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, BlobImmunity.class, 10f);
}
}
}
}

View File

@ -22,10 +22,11 @@
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.Barkskin;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -42,12 +43,15 @@ public class Earthroot extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
if (Dungeon.hero.subClass == HeroSubClass.WARDEN){
Buff.affect(ch, Barkskin.class).set((Dungeon.depth + 5)/2, 5);
} else {
Buff.affect(ch, Armor.class).level(ch.HT);
}
}
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.bottom( pos ).start( EarthParticle.FACTORY, 0.05f, 8 );

View File

@ -22,14 +22,20 @@
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.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.noosa.Game;
public class Fadeleaf extends Plant {
@ -38,14 +44,32 @@ public class Fadeleaf extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( final Char ch ) {
if (ch instanceof Hero) {
ScrollOfTeleportation.teleportHero( (Hero)ch );
((Hero)ch).curAction = null;
if (((Hero) ch).subClass == HeroSubClass.WARDEN){
if (Dungeon.bossLevel()) {
GLog.w( Messages.get(ScrollOfTeleportation.class, "no_tele") );
return;
}
Buff buff = Dungeon.hero.buff(TimekeepersHourglass.timeFreeze.class);
if (buff != null) buff.detach();
InterlevelScene.mode = InterlevelScene.Mode.RETURN;
InterlevelScene.returnDepth = Math.max(1, (Dungeon.depth - 1));
InterlevelScene.returnPos = -2;
Game.switchScene( InterlevelScene.class );
} else {
ScrollOfTeleportation.teleportHero((Hero) ch);
}
} else if (ch instanceof Mob && !ch.properties().contains(Char.Property.IMMOVABLE)) {
int count = 10;

View File

@ -22,8 +22,13 @@
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.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -36,7 +41,11 @@ public class Firebloom extends Plant {
}
@Override
public void activate() {
public void activate( Char ch ) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, FireImbue.class).set(15f);
}
GameScene.add( Blob.seed( pos, 2, Fire.class ) );

View File

@ -22,8 +22,13 @@
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.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FrostImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.watabou.utils.PathFinder;
@ -35,7 +40,11 @@ public class Icecap extends Plant {
}
@Override
public void activate() {
public void activate( Char ch ) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, FrostImbue.class, 15f);
}
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.losBlocking, null ), 1 );

View File

@ -60,10 +60,10 @@ public abstract class Plant implements Bundlable {
}
wither();
activate();
activate( ch );
}
public abstract void activate();
public abstract void activate( Char ch );
public void wither() {
Dungeon.level.uproot( pos );

View File

@ -22,6 +22,11 @@
package com.shatteredpixel.shatteredpixeldungeon.plants;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AdrenalineSurge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -33,7 +38,11 @@ public class Rotberry extends Plant {
}
@Override
public void activate() {
public void activate( Char ch ) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, AdrenalineSurge.class).reset(1, 200f);
}
Dungeon.level.drop( new Seed(), pos ).sprite.drop();
}

View File

@ -22,10 +22,12 @@
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;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ToxicImbue;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@ -37,8 +39,10 @@ public class Sorrowmoss extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, ToxicImbue.class).set(15f);
}
if (ch != null) {
Buff.affect( ch, Poison.class ).set( 4 + Dungeon.depth / 2 );

View File

@ -22,10 +22,12 @@
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;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random;
@ -36,10 +38,14 @@ public class Starflower extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch != null) Buff.prolong(ch, Bless.class, Bless.DURATION);
if (ch != null) {
Buff.prolong(ch, Bless.class, Bless.DURATION);
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.prolong(ch, Recharging.class, Bless.DURATION);
}
}
if (Random.Int(5) == 0){
Dungeon.level.drop(new Seed(), pos).sprite.drop();

View File

@ -21,10 +21,12 @@
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.Levitation;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Stormvine extends Plant {
@ -34,13 +36,16 @@ public class Stormvine extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch != null) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, Levitation.class, 10f);
} else {
Buff.affect(ch, Vertigo.class, Vertigo.DURATION);
}
}
}
public static class Seed extends Plant.Seed {
{

View File

@ -22,11 +22,12 @@
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.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
@ -43,12 +44,15 @@ public class Sungrass extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
if (Dungeon.hero.subClass == HeroSubClass.WARDEN) {
Buff.affect(ch, Healing.class).setHeal(ch.HT, 0, 1);
} else {
Buff.affect(ch, Health.class).boost(ch.HT);
}
}
if (Dungeon.level.heroFOV[pos]) {
CellEmitter.get( pos ).start( ShaftParticle.FACTORY, 0.2f, 3 );

View File

@ -22,10 +22,11 @@
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.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@ -39,10 +40,12 @@ public class Swiftthistle extends Plant {
}
@Override
public void activate() {
Char ch = Actor.findChar(pos);
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
Buff.affect(ch, TimeBubble.class).reset();
if (Dungeon.hero.subClass == HeroSubClass.WARDEN){
Buff.affect(ch, Haste.class, 5f);
}
}
}