v1.4.0: adjusted code for several plant effects, added a rotberry effect

This commit is contained in:
Evan Debenham
2022-08-22 13:22:12 -04:00
parent 411f015a97
commit ae3f37e0d1
12 changed files with 57 additions and 40 deletions

View File

@@ -18,7 +18,7 @@ plants.earthroot.desc=When a creature touches an earthroot, its roots create a k
plants.earthroot.warden_desc=The roots of an earthroot plant will move with _the Warden_, providing her mobile barkskin armor.
plants.earthroot$seed.name=seed of earthroot
plants.earthroot$armor.name=herbal armor
plants.earthroot$armor.desc=A kind of natural, immobile armor is protecting you. The armor forms plates of bark and twine, wrapping around your body.\n\nThis herbal armor will block %d damage from any physical hit you take, until it eventually runs out of durability and collapses.\n\nAs the armor is immobile, if you attempt to move it will break apart and be lost.\n\nArmor remaining: %d.
plants.earthroot$armor.desc=A kind of natural, immobile armor made of bark and twine.\n\nThis herbal armor will block %d damage from any physical hit, until it eventually runs out of durability and collapses.\n\nAs the armor is immobile, moving will cause it to break apart and be lost.\n\nArmor remaining: %d.
plants.fadeleaf.name=fadeleaf
plants.fadeleaf.desc=Touching a fadeleaf will teleport any creature to a random place on the current level.
@@ -43,7 +43,7 @@ plants.plant$seed$placeholder.name=seed
plants.rotberry.name=rotberry
plants.rotberry.desc=The berries of a young rotberry shrub taste like sweet, sweet death. Over a few years, this rotberry shrub will grow into another rot heart.
plants.rotberry.warden_desc=Normally a rotberry bush has no effect when trampled, but _the Warden_ is able to harness energy from it to temporarily boost her strength!
plants.rotberry.warden_desc=Normally a rotberry bush only produces a little gas when trampled, but _the Warden_ is able to harness energy from it to temporarily boost her strength!
plants.rotberry$seed.name=seed of rotberry
plants.sorrowmoss.name=sorrowmoss
@@ -66,11 +66,11 @@ plants.sungrass.desc=Sungrass is renowned for its sap's slow but effective heali
plants.sungrass.warden_desc=_The Warden_ can receive healing from trampled sungrass even if she moves away from it.
plants.sungrass$seed.name=seed of sungrass
plants.sungrass$health.name=herbal healing
plants.sungrass$health.desc=Sungrass possesses excellent healing properties, though it is much slower than a potion of healing.\n\nYou are currently slowly regenerating health from the sungrass plant. Moving off the plant will break the healing effect.\n\nHealing remaining: %d.
plants.sungrass$health.desc=Sungrass possesses excellent healing properties, though it is much slower than a potion of healing.\n\nMoving off the plant will break the healing effect.\n\nHealing remaining: %d.
plants.swiftthistle.name=swiftthistle
plants.swiftthistle.desc=When trampled, swiftthistle will briefly accelerate the flow of time around it, allowing the trampler to perform several actions instantly.
plants.swiftthistle.warden_desc=In addition to gaining instantaneous actions, _the Warden_ will also get a brief haste boost when trampling swiftthistle.
plants.swiftthistle$seed.name=seed of swiftthistle
plants.swiftthistle$timebubble.name=time bubble
plants.swiftthistle$timebubble.desc=You are in a small bubble of accelerated time, allowing you to perform actions instantly. Attacking or using magic will break this effect however.\n\nTurns remaining: %s.
plants.swiftthistle$timebubble.desc=A small bubble of accelerated time, allowing actions to be performed instantly. Attacking or using magic will break this effect however.\n\nTurns remaining: %s.

View File

@@ -55,8 +55,8 @@ public abstract class Actor implements Bundlable {
protected abstract boolean act();
//Always spends exactly one tick, regardless of time-influencing factors
protected final void spendConstant( float time ){
//Always spends exactly the specified amount of time, regardless of time-influencing factors
protected void spendConstant( float time ){
this.time += time;
//if time is very close to a whole number, round to a whole number to fix errors
float ex = Math.abs(this.time % 1f);
@@ -65,7 +65,7 @@ public abstract class Actor implements Bundlable {
}
}
//can be overridden for time to be affected by various factors
//sends time, but the amount can be influenced
protected void spend( float time ) {
spendConstant( time );
}

View File

@@ -80,6 +80,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfArcana;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
@@ -104,6 +105,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Door;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrimTrap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
@@ -540,6 +543,12 @@ public abstract class Char extends Actor {
}
public int defenseProc( Char enemy, int damage ) {
Earthroot.Armor armor = buff( Earthroot.Armor.class );
if (armor != null) {
damage = armor.absorb( damage );
}
return damage;
}
@@ -728,10 +737,27 @@ public abstract class Char extends Actor {
public boolean isAlive() {
return HP > 0 || deathMarked;
}
@Override
protected void spendConstant(float time) {
TimekeepersHourglass.timeFreeze freeze = buff(TimekeepersHourglass.timeFreeze.class);
if (freeze != null) {
freeze.processTime(time);
return;
}
Swiftthistle.TimeBubble bubble = buff(Swiftthistle.TimeBubble.class);
if (bubble != null){
bubble.processTime(time);
return;
}
super.spendConstant(time);
}
@Override
protected void spend( float time ) {
float timeScale = 1f;
if (buff( Slow.class ) != null) {
timeScale *= 0.5f;

View File

@@ -627,17 +627,6 @@ public class Hero extends Char {
@Override
public void spend( float time ) {
justMoved = false;
TimekeepersHourglass.timeFreeze freeze = buff(TimekeepersHourglass.timeFreeze.class);
if (freeze != null) {
freeze.processTime(time);
return;
}
Swiftthistle.TimeBubble bubble = buff(Swiftthistle.TimeBubble.class);
if (bubble != null){
bubble.processTime(time);
return;
}
super.spend(time);
}
@@ -1212,18 +1201,13 @@ public class Hero extends Char {
if (belongings.armor() != null) {
damage = belongings.armor().proc( enemy, this, damage );
}
Earthroot.Armor armor = buff( Earthroot.Armor.class );
if (armor != null) {
damage = armor.absorb( damage );
}
WandOfLivingEarth.RockArmor rockArmor = buff(WandOfLivingEarth.RockArmor.class);
if (rockArmor != null) {
damage = rockArmor.absorb(damage);
}
return damage;
return super.defenseProc( enemy, damage );
}
@Override

View File

@@ -91,8 +91,8 @@ public class ArmoredStatue extends Statue {
@Override
public int defenseProc(Char enemy, int damage) {
damage = super.defenseProc(enemy, damage);
return armor.proc(enemy, this, damage);
damage = armor.proc(enemy, this, damage);
return super.defenseProc(enemy, damage);
}
@Override

View File

@@ -650,7 +650,7 @@ public abstract class Mob extends Char {
}
}
return damage;
return super.defenseProc(enemy, damage);
}
@Override

View File

@@ -185,12 +185,10 @@ public class PrismaticImage extends NPC {
@Override
public int defenseProc(Char enemy, int damage) {
damage = super.defenseProc(enemy, damage);
if (hero != null && hero.belongings.armor() != null){
return hero.belongings.armor().proc( enemy, this, damage );
} else {
return damage;
damage = hero.belongings.armor().proc( enemy, this, damage );
}
return super.defenseProc(enemy, damage);
}
@Override

View File

@@ -382,6 +382,7 @@ public class TimekeepersHourglass extends Artifact {
@Override
public void fx(boolean on) {
if (!(target instanceof Hero)) return;
Emitter.freezeEmitters = on;
if (on){
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
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.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.EarthParticle;
@@ -43,9 +44,9 @@ public class Earthroot extends Plant {
@Override
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
if (Dungeon.hero.subClass == HeroSubClass.WARDEN){
if (ch != null){
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN) {
Buff.affect(ch, Barkskin.class).set(Dungeon.hero.lvl + 5, 5);
} else {
Buff.affect(ch, Armor.class).level(ch.HT);

View File

@@ -23,12 +23,15 @@ 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.ToxicGas;
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.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Rotberry extends Plant {
@@ -42,6 +45,8 @@ public class Rotberry extends Plant {
public void activate( Char ch ) {
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, AdrenalineSurge.class).reset(1, AdrenalineSurge.DURATION);
} else {
GameScene.add( Blob.seed( pos, 100, ToxicGas.class ) );
}
Dungeon.level.drop( new Seed(), pos ).sprite.drop();

View File

@@ -45,8 +45,8 @@ public class Sungrass extends Plant {
@Override
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
if (Dungeon.hero.subClass == HeroSubClass.WARDEN) {
if (ch != null){
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN) {
Buff.affect(ch, Healing.class).setHeal(ch.HT, 0, 1);
} else {
Buff.affect(ch, Health.class).boost(ch.HT);

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
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.levels.traps.Trap;
@@ -47,9 +48,9 @@ public class Swiftthistle extends Plant {
@Override
public void activate( Char ch ) {
if (ch == Dungeon.hero) {
if (ch != null) {
Buff.affect(ch, TimeBubble.class).reset();
if (Dungeon.hero.subClass == HeroSubClass.WARDEN){
if (ch instanceof Hero && ((Hero) ch).subClass == HeroSubClass.WARDEN){
Buff.affect(ch, Haste.class, 1f);
}
}
@@ -146,6 +147,7 @@ public class Swiftthistle extends Plant {
@Override
public void fx(boolean on) {
if (!(target instanceof Hero)) return;
Emitter.freezeEmitters = on;
if (on){
for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {