Skip to content

Commit

Permalink
Most depth-based effects now scale exponentially like the hero and mobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smujb committed May 29, 2021
1 parent 4356377 commit 5242818
Show file tree
Hide file tree
Showing 30 changed files with 45 additions and 176 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

package com.shatteredpixel.yasd.general.actors.blobs;

import com.shatteredpixel.yasd.general.Constants;
import com.shatteredpixel.yasd.general.Dungeon;
import com.shatteredpixel.yasd.general.Element;
import com.shatteredpixel.yasd.general.actors.Actor;
Expand Down Expand Up @@ -80,7 +79,7 @@ protected void evolve() {
if (ch != null && !ch.isImmune(this.getClass())) {
Buff.prolong( ch, Paralysis.class, 1f);
if (cur[cell] % 2 == 1) {
ch.damage(Math.round(Random.Float(2 + Dungeon.getScaling() / Constants.CHAPTER_LENGTH)), new Char.DamageSrc(Element.SHOCK, this).ignoreDefense() );
ch.damage(Math.round(Random.Float(4 * Dungeon.getScaleModifier())), new Char.DamageSrc(Element.SHOCK, this).ignoreDefense() );
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() );
GLog.negative( Messages.get(this, "ondeath") );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class HolyWater extends Gas {

@Override
public void affectCell(int cell) {
int damage = 1 + Dungeon.getScaling()/6;
int damage = (int) Dungeon.getScaleModifier();
Char ch = Actor.findChar( cell );
if (ch != null && !ch.isImmune(this.getClass())) {
ch.heal( damage, true, true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.shatteredpixel.yasd.general.Dungeon;
import com.shatteredpixel.yasd.general.Element;
import com.shatteredpixel.yasd.general.actors.hero.Hero;
import com.shatteredpixel.yasd.general.items.Item;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.ui.BuffIndicator;
import com.shatteredpixel.yasd.general.utils.GLog;
Expand All @@ -56,7 +57,7 @@ public class Corrosion extends Buff implements Hero.Doom {
}

public static float defaultStrength(int scale) {
return 2 * scale;
return 4 * Item.calcMobPower(scale);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

package com.shatteredpixel.yasd.general.actors.buffs;

import com.shatteredpixel.yasd.general.Constants;
import com.shatteredpixel.yasd.general.Dungeon;
import com.shatteredpixel.yasd.general.Element;
import com.shatteredpixel.yasd.general.messages.Messages;
Expand Down Expand Up @@ -106,10 +105,8 @@ public void set(float left){
@Override
public boolean act() {
if (target.isAlive()) {
if (Dungeon.getScaling() > 4)
target.damage( Dungeon.getScaling()/Constants.CHAPTER_LENGTH, this);
else if (Random.Int(2) == 0)
target.damage( 1, this );
if (Random.Int(2) == 0)
target.damage((int) Dungeon.getScaleModifier(), this );
if (!target.isAlive() && target == Dungeon.hero) {
Dungeon.fail( getClass() );
GLog.negative( Messages.get(this, "ondeath") );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ public void fx(boolean on) {
if (on) target.sprite.add( CharSprite.State.POISONED );
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.POISONED );
}

//Linear scaling as poison damage is already exponential
public static int defaultStrength(int depth) {
return 6 + depth;
}

public void set( float duration ) {
this.left = Math.max(duration, left);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.shatteredpixel.yasd.general.actors.hero.Hero;
import com.shatteredpixel.yasd.general.actors.mobs.Mob;
import com.shatteredpixel.yasd.general.actors.mobs.npcs.PrismaticImage;
import com.shatteredpixel.yasd.general.items.Item;
import com.shatteredpixel.yasd.general.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.yasd.general.messages.Messages;
import com.shatteredpixel.yasd.general.scenes.GameScene;
Expand Down Expand Up @@ -109,11 +110,7 @@ public int maxHP(){
}

public static int maxHP( Char hero ){
if (hero instanceof Hero) {
return 8 + (int) Math.floor(((Hero)hero).lvl * 2.5f);
} else {
return 8 + (int) Math.floor(Dungeon.getScaling() * 2.5f);
}
return (int) (50 * Item.calcMobPower(hero.level()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class Bee extends Mob {

flying = true;
state = WANDERING;

healthFactor = 1.5f;
damageFactor = 0.75f;

//only applicable when the bee is charmed with elixir of honeyed healing
intelligentAlly = true;
Expand Down Expand Up @@ -94,10 +97,7 @@ public void add(Buff buff) {
}

public void spawn( int level ) {
this.level = level;

HT = (2 + level) * 4;
defenseSkill = 9 + level;
setLevel(level);
}

public void setPotInfo(int potPos, Char potHolder){
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ public void destroy() {
Badges.validateMonstersSlain();
Statistics.qualifiedForNoKilling = false;

int exp = Dungeon.hero.lvl <= Dungeon.getScaling() + 2 ? experience() : 0;
int exp = Dungeon.hero.lvl <= level + 1 ? experience() : 0;
Dungeon.hero.earnExp(exp, getClass());

//If the hero is cursed, eliminate an enemy from the curse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ protected void evolve() {

Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)){
int dmg = Random.NormalIntRange(5 + Dungeon.getScaling(), 10 + Dungeon.getScaling() *2);
int dmg = Random.NormalIntRange((int) (5 * Dungeon.getScaleModifier()), (int) (10 * Dungeon.getScaleModifier()));

ch.damage(dmg, new DamageSrc(Element.PHYSICAL, this));

Expand Down Expand Up @@ -994,7 +994,7 @@ protected void evolve() {

Char ch = Actor.findChar(cell);
if (ch != null && !(ch instanceof NewTengu)){
ch.damage(2 + Dungeon.getScaling()*2, Element.SHOCK);
ch.damage((int) (5*Dungeon.getScaleModifier()), Element.SHOCK);

if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(NewTengu.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ public Element elementalType() {

@Override
public void rollToDropLoot() {
if (Dungeon.hero.lvl > Dungeon.getScaling() + 3) return;

super.rollToDropLoot();

int ofs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.shatteredpixel.yasd.general.actors.hero.Belongings;
import com.shatteredpixel.yasd.general.effects.MagicMissile;
import com.shatteredpixel.yasd.general.items.Ankh;
import com.shatteredpixel.yasd.general.items.EquipableItem;
import com.shatteredpixel.yasd.general.items.Generator;
import com.shatteredpixel.yasd.general.items.Item;
import com.shatteredpixel.yasd.general.items.KindofMisc;
Expand Down Expand Up @@ -160,20 +159,9 @@ private KindofMisc newItem() {
}

protected void upgradeItems() {
int sous = Dungeon.getScaling()*5;
EquipableItem item;
if (belongings.miscs.length > 0) {
do {
do {
item = null;
int slot = Random.Int(belongings.miscs.length);
if (slot < belongings.miscs.length) {
item = belongings.miscs[slot];
}
} while (item == null || !item.isUpgradable());//If the item is not upgradeable (An artifact or +3) chose another. Also, if it is null (nothing equipped in that slot)
item.upgrade();
sous--;
} while (sous > 0);
int upgrade = Dungeon.getScaling();
for (Item item : belongings.miscs) {
item.level(upgrade + Random.IntRange(-2, 3));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public void explode(int cell) {
}

for (Char ch : affected){
// 100%/83%/67% bomb damage based on distance, but pierces getArmors.
int damage = Math.round(Random.NormalIntRange( Dungeon.getScaling() +5, 10 + Dungeon.getScaling() * 2 ));
// 100%/83%/67% bomb damage based on distance, but pierces armour.
int damage = Math.round(Random.NormalIntRange((int) (Dungeon.getScaleModifier() * 5), (int) (10 * Dungeon.getScaleModifier())));
float multiplier = 1f - (.16667f*Dungeon.level.distance(cell, ch.pos));
ch.damage(Math.round(damage*multiplier), new Char.DamageSrc(Element.MAGICAL, this));
ch.damage(Math.round(damage*multiplier), new Char.DamageSrc(Element.MAGICAL, this).ignoreDefense());
if (ch == Dungeon.hero && !ch.isAlive()){
Dungeon.fail(Bomb.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void explode(int cell){
continue;
}

int dmg = Random.NormalIntRange(5 + Dungeon.getScaling(), 10 + Dungeon.getScaling() *2);
int dmg = Math.round(Random.NormalIntRange((int) (Dungeon.getScaleModifier() * 5), (int) (10 * Dungeon.getScaleModifier())));

//those not at the center of the blast take less damage
if (ch.pos != cell){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void explode(int cell) {
ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10 );

//bomb deals an additional 67% damage to unholy enemies in a 5x5 range
int damage = Math.round(Random.NormalIntRange( Dungeon.getScaling() +5, 10 + Dungeon.getScaling() * 2 ) * 0.67f);
int damage = (int) (Math.round(Random.NormalIntRange((int) (Dungeon.getScaleModifier() * 5), (int) (10 * Dungeon.getScaleModifier()))) * 0.67f);
ch.damage(damage, new Char.DamageSrc(Element.LIGHT, this));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void explode(int cell) {
int power = 16 - 4*Dungeon.level.distance(ch.pos, cell);
if (power > 0){
//32% to 8% regular bomb damage
int damage = Math.round(Random.NormalIntRange(5 + Dungeon.getScaling(), 10 + 2*Dungeon.getScaling()) * (power/50f));
int damage = (int) (Math.round(Random.NormalIntRange((int) (Dungeon.getScaleModifier() * 5), (int) (10 * Dungeon.getScaleModifier()))) * (power/50f));
ch.damage(damage, new Char.DamageSrc(Element.SHOCK, this));
if (ch.isAlive()) Buff.prolong(ch, Paralysis.class, power);
arcs.add(new Lightning.Arc(DungeonTilemap.tileCenterToWorld(cell), ch.sprite.center(), Lightning.DEFAULT_COLOUR));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void explode(int cell) {

for (Char ch : affected){
//regular bomb damage, which falls off at a rate of 5% per tile of distance
int damage = Math.round(Random.NormalIntRange( Dungeon.getScaling() +5, 10 + Dungeon.getScaling() * 2 ));
int damage = Math.round(Random.NormalIntRange((int) (Dungeon.getScaleModifier() * 5), (int) (10 * Dungeon.getScaleModifier())));
damage = Math.round(damage * (1f - .05f*Dungeon.level.distance(cell, ch.pos)));
ch.damage(damage, new Char.DamageSrc(Element.PHYSICAL, this) );
if (ch == Dungeon.hero && !ch.isAlive()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PestilentShield extends Shield {

@Override
public int proc(Char attacker, Char enemy, int damage, boolean parry) {
if (parry) Buff.affect(enemy, Poison.class).set(3 + Dungeon.getScaling());
if (parry) Buff.affect(enemy, Poison.class).set(Poison.defaultStrength(Dungeon.getScaling()));
return super.proc(attacker, enemy, damage, parry);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public void upgrade(int wandLevel ){

wandHeal(0);

//TODO refactor for new health system
switch (tier){
case 1: case 2: default:
break; //do nothing
Expand Down Expand Up @@ -326,14 +327,6 @@ private void wandHeal( int wandLevel ){
if (sprite != null) sprite.showStatus(CharSprite.POSITIVE, Integer.toString(heal));
}

@Override
public int defenseSkill(Char enemy) {
if (tier > 3){
defenseSkill = 4 + Dungeon.getScaling();
}
return super.defenseSkill(enemy);
}

@Override
public float attackDelay() {
if (tier > 3){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.shatteredpixel.yasd.general.levels.traps;

import com.shatteredpixel.yasd.general.Assets;
import com.shatteredpixel.yasd.general.Dungeon;
import com.shatteredpixel.yasd.general.actors.blobs.Blob;
import com.shatteredpixel.yasd.general.actors.blobs.ConfusionGas;
import com.shatteredpixel.yasd.general.scenes.GameScene;
Expand All @@ -44,7 +43,7 @@ public class ConfusionTrap extends Trap {
@Override
public void activate() {

GameScene.add(Blob.seed(pos, 300 + 20 * Dungeon.getScaling(), ConfusionGas.class));
GameScene.add(Blob.seed(pos, 500, ConfusionGas.class));
Sample.INSTANCE.play(Assets.Sounds.GAS);

}
Expand Down
Loading

0 comments on commit 5242818

Please sign in to comment.