v2.1.0: adjusted rankings logic so more info reaches Rankings.submit

This commit is contained in:
Evan Debenham
2023-05-07 11:44:22 -04:00
parent f7757d6424
commit e3a035aac4
54 changed files with 64 additions and 64 deletions
@@ -774,7 +774,7 @@ public class Dungeon {
Statistics.preview( info, bundle ); Statistics.preview( info, bundle );
} }
public static void fail( Class cause ) { public static void fail( Object cause ) {
if (WndResurrect.instance == null) { if (WndResurrect.instance == null) {
updateLevelExplored(); updateLevelExplored();
Statistics.gameWon = false; Statistics.gameWon = false;
@@ -782,7 +782,7 @@ public class Dungeon {
} }
} }
public static void win( Class cause ) { public static void win( Object cause ) {
updateLevelExplored(); updateLevelExplored();
Statistics.gameWon = true; Statistics.gameWon = true;
@@ -77,7 +77,7 @@ public enum Rankings {
public Record latestDailyReplay = null; //not stored, only meant to be temp public Record latestDailyReplay = null; //not stored, only meant to be temp
public LinkedHashMap<Long, Integer> dailyScoreHistory = new LinkedHashMap<>(); public LinkedHashMap<Long, Integer> dailyScoreHistory = new LinkedHashMap<>();
public void submit( boolean win, Class cause ) { public void submit( boolean win, Object cause ) {
load(); load();
@@ -95,7 +95,7 @@ public enum Rankings {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT); DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
rec.date = format.format(new Date(Game.realTime)); rec.date = format.format(new Date(Game.realTime));
rec.cause = cause; rec.cause = cause instanceof Class ? (Class)cause : cause.getClass();
rec.win = win; rec.win = win;
rec.heroClass = Dungeon.hero.heroClass; rec.heroClass = Dungeon.hero.heroClass;
rec.armorTier = Dungeon.hero.tier(); rec.armorTier = Dungeon.hero.tier();
@@ -486,7 +486,7 @@ public abstract class Char extends Actor {
|| this instanceof MirrorImage || this instanceof PrismaticImage){ || this instanceof MirrorImage || this instanceof PrismaticImage){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
} }
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} else if (this == Dungeon.hero) { } else if (this == Dungeon.hero) {
@@ -76,7 +76,7 @@ public class Electricity extends Blob {
if (cur[cell] % 2 == 1) { if (cur[cell] % 2 == 1) {
ch.damage(Math.round(Random.Float(2 + Dungeon.scalingDepth() / 5f)), this); ch.damage(Math.round(Random.Float(2 + Dungeon.scalingDepth() / 5f)), this);
if (!ch.isAlive() && ch == Dungeon.hero){ if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -72,7 +72,7 @@ public class ToxicGas extends Blob implements Hero.Doom {
Badges.validateDeathFromGas(); Badges.validateDeathFromGas();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -120,7 +120,7 @@ public class Berserk extends Buff implements ActionIndicator.Action {
BuffIndicator.refreshHero(); BuffIndicator.refreshHero();
if (!target.isAlive()){ if (!target.isAlive()){
target.die(this); target.die(this);
if (!target.isAlive()) Dungeon.fail(this.getClass()); if (!target.isAlive()) Dungeon.fail(this);
} }
} }
@@ -129,7 +129,7 @@ public class Berserk extends Buff implements ActionIndicator.Action {
power = 0f; power = 0f;
if (!target.isAlive()){ if (!target.isAlive()){
target.die(this); target.die(this);
if (!target.isAlive()) Dungeon.fail(this.getClass()); if (!target.isAlive()) Dungeon.fail(this);
} }
} }
@@ -111,7 +111,7 @@ public class Bleeding extends Buff {
} else if (source == Sacrificial.class){ } else if (source == Sacrificial.class){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
} }
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
@@ -224,7 +224,7 @@ public class Burning extends Buff implements Hero.Doom {
Badges.validateDeathFromFire(); Badges.validateDeathFromFire();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -364,7 +364,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
dist--; dist--;
} }
} }
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero.getClass()); WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero);
break; break;
case PARRY: case PARRY:
hit(enemy); hit(enemy);
@@ -121,7 +121,7 @@ public class Corrosion extends Buff implements Hero.Doom {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
} }
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n(Messages.get(this, "ondeath")); GLog.n(Messages.get(this, "ondeath"));
} }
@@ -198,7 +198,7 @@ public class Hunger extends Buff implements Hero.Doom {
Badges.validateDeathFromHunger(); Badges.validateDeathFromHunger();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -578,7 +578,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
//trim it to just be the part that goes past them //trim it to just be the part that goes past them
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE); trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
//knock them back along that ballistica //knock them back along that ballistica
WandOfBlastWave.throwChar(enemy, trajectory, 6, true, false, hero.getClass()); WandOfBlastWave.throwChar(enemy, trajectory, 6, true, false, hero);
if (trajectory.dist > 0) { if (trajectory.dist > 0) {
Buff.affect(enemy, Paralysis.class, Math.min( 6, trajectory.dist)); Buff.affect(enemy, Paralysis.class, Math.min( 6, trajectory.dist));
@@ -599,7 +599,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
//trim it to just be the part that goes past them //trim it to just be the part that goes past them
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE); trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
//knock them back along that ballistica //knock them back along that ballistica
WandOfBlastWave.throwChar(ch, trajectory, 6, true, false, hero.getClass()); WandOfBlastWave.throwChar(ch, trajectory, 6, true, false, hero);
if (trajectory.dist > 0) { if (trajectory.dist > 0) {
Buff.affect(ch, Paralysis.class, Math.min( 6, trajectory.dist)); Buff.affect(ch, Paralysis.class, Math.min( 6, trajectory.dist));
@@ -88,7 +88,7 @@ public class Ooze extends Buff {
} }
if (!target.isAlive() && target == Dungeon.hero) { if (!target.isAlive() && target == Dungeon.hero) {
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
spend( TICK ); spend( TICK );
@@ -117,7 +117,7 @@ public class Poison extends Buff implements Hero.Doom {
public void onDeath() { public void onDeath() {
Badges.validateDeathFromPoison(); Badges.validateDeathFromPoison();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -401,7 +401,7 @@ public class ElementalStrike extends ArmorAbility {
knockback, knockback,
true, true,
true, true,
ElementalStrike.this.getClass()); ElementalStrike.this);
} }
//*** Lucky *** //*** Lucky ***
@@ -297,7 +297,7 @@ public class ElementalBlast extends ArmorAbility {
knockback, knockback,
true, true,
true, true,
ElementalBlast.this.getClass()); ElementalBlast.this);
} }
//*** Wand of Frost *** //*** Wand of Frost ***
@@ -103,7 +103,7 @@ public class HeroicLeap extends ArmorAbility {
if (mob.pos == hero.pos + i && hero.hasTalent(Talent.IMPACT_WAVE)){ if (mob.pos == hero.pos + i && hero.hasTalent(Talent.IMPACT_WAVE)){
Ballistica trajectory = new Ballistica(mob.pos, mob.pos + i, Ballistica.MAGIC_BOLT); Ballistica trajectory = new Ballistica(mob.pos, mob.pos + i, Ballistica.MAGIC_BOLT);
int strength = 1+hero.pointsInTalent(Talent.IMPACT_WAVE); int strength = 1+hero.pointsInTalent(Talent.IMPACT_WAVE);
WandOfBlastWave.throwChar(mob, trajectory, strength, true, true, HeroicLeap.this.getClass()); WandOfBlastWave.throwChar(mob, trajectory, strength, true, true, HeroicLeap.this);
if (Random.Int(4) < hero.pointsInTalent(Talent.IMPACT_WAVE)){ if (Random.Int(4) < hero.pointsInTalent(Talent.IMPACT_WAVE)){
Buff.prolong(mob, Vulnerable.class, 5f); Buff.prolong(mob, Vulnerable.class, 5f);
} }
@@ -110,7 +110,7 @@ public class DM100 extends Mob implements Callback {
if (!enemy.isAlive()) { if (!enemy.isAlive()) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "zap_kill") ); GLog.n( Messages.get(this, "zap_kill") );
} }
} }
@@ -410,7 +410,7 @@ public class DM300 extends Mob {
if (Dungeon.level.adjacent(pos, target.pos)){ if (Dungeon.level.adjacent(pos, target.pos)){
int oppositeAdjacent = target.pos + (target.pos - pos); int oppositeAdjacent = target.pos + (target.pos - pos);
Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT); Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT);
WandOfBlastWave.throwChar(target, trajectory, 2, false, false, getClass()); WandOfBlastWave.throwChar(target, trajectory, 2, false, false, this);
if (target == Dungeon.hero){ if (target == Dungeon.hero){
Dungeon.hero.interrupt(); Dungeon.hero.interrupt();
} }
@@ -420,7 +420,7 @@ public class DM300 extends Mob {
} else if (fieldOfView[target.pos] && Dungeon.level.distance(pos, target.pos) == 2) { } else if (fieldOfView[target.pos] && Dungeon.level.distance(pos, target.pos) == 2) {
int oppositeAdjacent = target.pos + (target.pos - pos); int oppositeAdjacent = target.pos + (target.pos - pos);
Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT); Ballistica trajectory = new Ballistica(target.pos, oppositeAdjacent, Ballistica.MAGIC_BOLT);
WandOfBlastWave.throwChar(target, trajectory, 1, false, false, getClass()); WandOfBlastWave.throwChar(target, trajectory, 1, false, false, this);
if (target == Dungeon.hero){ if (target == Dungeon.hero){
Dungeon.hero.interrupt(); Dungeon.hero.interrupt();
} }
@@ -338,7 +338,7 @@ public abstract class Elemental extends Mob {
for (Char ch : affected) { for (Char ch : affected) {
ch.damage( Math.round( damage * 0.4f ), Shocking.class ); ch.damage( Math.round( damage * 0.4f ), Shocking.class );
if (ch == Dungeon.hero && !ch.isAlive()){ if (ch == Dungeon.hero && !ch.isAlive()){
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} }
} }
@@ -195,7 +195,7 @@ public class Eye extends Mob {
if (!ch.isAlive() && ch == Dungeon.hero) { if (!ch.isAlive() && ch == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "deathgaze_kill") ); GLog.n( Messages.get(this, "deathgaze_kill") );
} }
} else { } else {
@@ -214,7 +214,7 @@ public class Necromancer extends Mob {
blocker.damage( Random.NormalIntRange(2, 10), this ); blocker.damage( Random.NormalIntRange(2, 10), this );
if (blocker == Dungeon.hero && !blocker.isAlive()){ if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass()); Dungeon.fail(this);
} }
} }
@@ -128,7 +128,7 @@ public abstract class Shaman extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) { if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "bolt_kill") ); GLog.n( Messages.get(this, "bolt_kill") );
} }
} else { } else {
@@ -84,7 +84,7 @@ public class Skeleton extends Mob {
} }
if (heroKilled) { if (heroKilled) {
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "explo_kill") ); GLog.n( Messages.get(this, "explo_kill") );
} }
} }
@@ -137,7 +137,7 @@ public class SpectralNecromancer extends Necromancer {
blocker.damage( Random.NormalIntRange(2, 10), this ); blocker.damage( Random.NormalIntRange(2, 10), this );
if (blocker == Dungeon.hero && !blocker.isAlive()){ if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass()); Dungeon.fail(this);
} }
} }
@@ -137,7 +137,7 @@ public class Statue extends Mob {
damage = super.attackProc( enemy, damage ); damage = super.attackProc( enemy, damage );
damage = weapon.proc( this, enemy, damage ); damage = weapon.proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){ if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} }
return damage; return damage;
@@ -121,7 +121,7 @@ public class Warlock extends Mob implements Callback {
if (enemy == Dungeon.hero && !enemy.isAlive()) { if (enemy == Dungeon.hero && !enemy.isAlive()) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "bolt_kill") ); GLog.n( Messages.get(this, "bolt_kill") );
} }
} else { } else {
@@ -244,7 +244,7 @@ public class YogDzewa extends Mob {
} }
if (!ch.isAlive() && ch == Dungeon.hero) { if (!ch.isAlive() && ch == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n(Messages.get(Char.class, "kill", name())); GLog.n(Messages.get(Char.class, "kill", name()));
} }
} else { } else {
@@ -503,7 +503,7 @@ public abstract class YogFist extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) { if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(Char.class, "kill", name()) ); GLog.n( Messages.get(Char.class, "kill", name()) );
} }
@@ -573,7 +573,7 @@ public abstract class YogFist extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) { if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(Char.class, "kill", name()) ); GLog.n( Messages.get(Char.class, "kill", name()) );
} }
@@ -173,7 +173,7 @@ public class MirrorImage extends NPC {
if (hero.belongings.weapon() != null){ if (hero.belongings.weapon() != null){
damage = hero.belongings.weapon().proc( this, enemy, damage ); damage = hero.belongings.weapon().proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){ if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} }
return damage; return damage;
@@ -53,7 +53,7 @@ public class Repulsion extends Armor.Glyph {
Math.round(2 * powerMulti), Math.round(2 * powerMulti),
true, true,
true, true,
getClass()); this);
} }
return damage; return damage;
@@ -161,7 +161,7 @@ public class Viscosity extends Glyph {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
spend( TICK ); spend( TICK );
@@ -124,7 +124,7 @@ public class ChaliceOfBlood extends Artifact {
if (!hero.isAlive()) { if (!hero.isAlive()) {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} else { } else {
upgrade(); upgrade();
@@ -632,7 +632,7 @@ public class DriedRose extends Artifact {
if (rose != null && rose.weapon != null) { if (rose != null && rose.weapon != null) {
damage = rose.weapon.proc( this, enemy, damage ); damage = rose.weapon.proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){ if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) ); GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} }
} }
@@ -86,7 +86,7 @@ public class ArcaneBomb extends Bomb.MagicalBomb {
ch.damage(Math.round(damage*multiplier), this); ch.damage(Math.round(damage*multiplier), this);
if (ch == Dungeon.hero && !ch.isAlive()){ if (ch == Dungeon.hero && !ch.isAlive()){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail(Bomb.class); Dungeon.fail(this);
} }
} }
} }
@@ -197,7 +197,7 @@ public class Bomb extends Item {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
} }
GLog.n(Messages.get(this, "ondeath")); GLog.n(Messages.get(this, "ondeath"));
Dungeon.fail(Bomb.class); Dungeon.fail(this);
} }
} }
@@ -73,7 +73,7 @@ public class ShrapnelBomb extends Bomb {
damage -= ch.drRoll(); damage -= ch.drRoll();
ch.damage(damage, this); ch.damage(damage, this);
if (ch == Dungeon.hero && !ch.isAlive()) { if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(Bomb.class); Dungeon.fail(this);
} }
} }
} }
@@ -68,7 +68,7 @@ public class ScrollOfPsionicBlast extends ExoticScroll {
readAnimation(); readAnimation();
} else { } else {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
@@ -40,7 +40,7 @@ public class AquaBlast extends TargetedSpell {
GeyserTrap geyser = new GeyserTrap(); GeyserTrap geyser = new GeyserTrap();
geyser.pos = cell; geyser.pos = cell;
geyser.source = getClass(); geyser.source = this;
if (bolt.path.size() > bolt.dist+1) { if (bolt.path.size() > bolt.dist+1) {
geyser.centerKnockBackDirection = bolt.path.get(bolt.dist + 1); geyser.centerKnockBackDirection = bolt.path.get(bolt.dist + 1);
} }
@@ -223,11 +223,11 @@ public class CursedWand {
if (!toDamage.isAlive()) { if (!toDamage.isAlive()) {
if (user == Dungeon.hero && origin != null) { if (user == Dungeon.hero && origin != null) {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( origin.getClass() ); Dungeon.fail( origin );
GLog.n( Messages.get( CursedWand.class, "ondeath", origin.name() ) ); GLog.n( Messages.get( CursedWand.class, "ondeath", origin.name() ) );
} else { } else {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail( toHeal.getClass() ); Dungeon.fail( toHeal );
} }
} }
} else { } else {
@@ -90,7 +90,7 @@ public class WandOfBlastWave extends DamageWand {
if (ch.pos == bolt.collisionPos + i) { if (ch.pos == bolt.collisionPos + i) {
Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT); Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT);
int strength = 1 + Math.round(buffedLvl() / 2f); int strength = 1 + Math.round(buffedLvl() / 2f);
throwChar(ch, trajectory, strength, false, true, getClass()); throwChar(ch, trajectory, strength, false, true, this);
} }
} }
@@ -105,14 +105,14 @@ public class WandOfBlastWave extends DamageWand {
if (bolt.path.size() > bolt.dist+1 && ch.pos == bolt.collisionPos) { if (bolt.path.size() > bolt.dist+1 && ch.pos == bolt.collisionPos) {
Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT); Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT);
int strength = buffedLvl() + 3; int strength = buffedLvl() + 3;
throwChar(ch, trajectory, strength, false, true, getClass()); throwChar(ch, trajectory, strength, false, true, this);
} }
} }
} }
public static void throwChar(final Char ch, final Ballistica trajectory, int power, public static void throwChar(final Char ch, final Ballistica trajectory, int power,
boolean closeDoors, boolean collideDmg, Class cause){ boolean closeDoors, boolean collideDmg, Object cause){
if (ch.properties().contains(Char.Property.BOSS)) { if (ch.properties().contains(Char.Property.BOSS)) {
power = (power+1)/2; power = (power+1)/2;
} }
@@ -165,7 +165,7 @@ public class WandOfBlastWave extends DamageWand {
if (ch.isActive()) { if (ch.isActive()) {
Paralysis.prolong(ch, Paralysis.class, 1 + finalDist/2f); Paralysis.prolong(ch, Paralysis.class, 1 + finalDist/2f);
} else if (ch == Dungeon.hero){ } else if (ch == Dungeon.hero){
if (cause == WandOfBlastWave.class || cause == AquaBlast.class){ if (cause instanceof WandOfBlastWave || cause instanceof AquaBlast){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
} }
Dungeon.fail(cause); Dungeon.fail(cause);
@@ -86,7 +86,7 @@ public class WandOfLightning extends DamageWand {
ch.damage(Math.round(damageRoll() * multiplier * 0.5f), this); ch.damage(Math.round(damageRoll() * multiplier * 0.5f), this);
if (!curUser.isAlive()) { if (!curUser.isAlive()) {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n(Messages.get(this, "ondeath")); GLog.n(Messages.get(this, "ondeath"));
} }
} else { } else {
@@ -133,7 +133,7 @@ public class WandOfTransfusion extends Wand {
if (!curUser.isAlive()){ if (!curUser.isAlive()){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -339,7 +339,7 @@ public class WandOfWarding extends Wand {
if (!enemy.isAlive() && enemy == Dungeon.hero) { if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() ); Dungeon.fail( this );
} }
totalZaps++; totalZaps++;
@@ -56,7 +56,7 @@ public class Elastic extends Weapon.Enchantment {
Math.round(2 * powerMulti), Math.round(2 * powerMulti),
!(weapon instanceof MissileWeapon || weapon instanceof SpiritBow), !(weapon instanceof MissileWeapon || weapon instanceof SpiritBow),
true, true,
getClass()); this);
} }
return damage; return damage;
@@ -95,7 +95,7 @@ public class Spear extends MeleeWeapon {
//trim it to just be the part that goes past them //trim it to just be the part that goes past them
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE); trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
//knock them back along that ballistica //knock them back along that ballistica
WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero.getClass()); WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero);
} else { } else {
wep.onAbilityKill(hero, enemy); wep.onAbilityKill(hero, enemy);
} }
@@ -74,7 +74,7 @@ public class ForceCube extends MissileWeapon {
curUser.shoot(target, this); curUser.shoot(target, this);
if (target == Dungeon.hero && !target.isAlive()){ if (target == Dungeon.hero && !target.isAlive()){
Badges.validateDeathFromFriendlyMagic(); Badges.validateDeathFromFriendlyMagic();
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n(Messages.get(this, "ondeath")); GLog.n(Messages.get(this, "ondeath"));
} }
} }
@@ -281,7 +281,7 @@ public class SentryRoom extends SpecialRoom {
Dungeon.hero.damage(Random.NormalIntRange(2 + Dungeon.depth / 2, 4 + Dungeon.depth), new Eye.DeathGaze()); Dungeon.hero.damage(Random.NormalIntRange(2 + Dungeon.depth / 2, 4 + Dungeon.depth), new Eye.DeathGaze());
if (!Dungeon.hero.isAlive()) { if (!Dungeon.hero.isAlive()) {
Badges.validateDeathFromEnemyMagic(); Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass()); Dungeon.fail(this);
GLog.n(Messages.capitalize(Messages.get(Char.class, "kill", name()))); GLog.n(Messages.capitalize(Messages.get(Char.class, "kill", name())));
} }
} else { } else {
@@ -79,7 +79,7 @@ public class DisintegrationTrap extends Trap {
Hero hero = (Hero)target; Hero hero = (Hero)target;
if (!hero.isAlive()){ if (!hero.isAlive()){
Badges.validateDeathFromGrimOrDisintTrap(); Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -46,7 +46,7 @@ public class GeyserTrap extends Trap {
} }
public int centerKnockBackDirection = -1; public int centerKnockBackDirection = -1;
public Class source = getClass(); public Object source = this;
@Override @Override
public void activate() { public void activate() {
@@ -100,7 +100,7 @@ public class GrimTrap extends Trap {
Sample.INSTANCE.play(Assets.Sounds.CURSED); Sample.INSTANCE.play(Assets.Sounds.CURSED);
if (!finalTarget.isAlive()) { if (!finalTarget.isAlive()) {
Badges.validateDeathFromGrimOrDisintTrap(); Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( GrimTrap.this.getClass() ); Dungeon.fail( GrimTrap.this );
GLog.n( Messages.get(GrimTrap.class, "ondeath") ); GLog.n( Messages.get(GrimTrap.class, "ondeath") );
} }
} else { } else {
@@ -104,7 +104,7 @@ public class PoisonDartTrap extends Trap {
Statistics.bossScores[1] -= 100; Statistics.bossScores[1] -= 100;
} }
if (!finalTarget.isAlive()) { if (!finalTarget.isAlive()) {
Dungeon.fail(PoisonDartTrap.this.getClass()); Dungeon.fail(PoisonDartTrap.this);
} }
} }
Buff.affect( finalTarget, Poison.class ).set( poisonAmount() ); Buff.affect( finalTarget, Poison.class ).set( poisonAmount() );
@@ -101,7 +101,7 @@ public class RockfallTrap extends Trap {
Buff.prolong( ch, Paralysis.class, Paralysis.DURATION ); Buff.prolong( ch, Paralysis.class, Paralysis.DURATION );
if (!ch.isAlive() && ch == Dungeon.hero){ if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() ); Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") ); GLog.n( Messages.get(this, "ondeath") );
} }
} }
@@ -83,7 +83,7 @@ public class WornDartTrap extends Trap {
int dmg = Random.NormalIntRange(4, 8) - finalTarget.drRoll(); int dmg = Random.NormalIntRange(4, 8) - finalTarget.drRoll();
finalTarget.damage(dmg, WornDartTrap.this); finalTarget.damage(dmg, WornDartTrap.this);
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){ if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
Dungeon.fail( WornDartTrap.this.getClass() ); Dungeon.fail( WornDartTrap.this );
} }
Sample.INSTANCE.play(Assets.Sounds.HIT, 1, 1, Random.Float(0.8f, 1.25f)); Sample.INSTANCE.play(Assets.Sounds.HIT, 1, 1, Random.Float(0.8f, 1.25f));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg); finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);