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

View File

@@ -774,7 +774,7 @@ public class Dungeon {
Statistics.preview( info, bundle );
}
public static void fail( Class cause ) {
public static void fail( Object cause ) {
if (WndResurrect.instance == null) {
updateLevelExplored();
Statistics.gameWon = false;
@@ -782,7 +782,7 @@ public class Dungeon {
}
}
public static void win( Class cause ) {
public static void win( Object cause ) {
updateLevelExplored();
Statistics.gameWon = true;

View File

@@ -77,7 +77,7 @@ public enum Rankings {
public Record latestDailyReplay = null; //not stored, only meant to be temp
public LinkedHashMap<Long, Integer> dailyScoreHistory = new LinkedHashMap<>();
public void submit( boolean win, Class cause ) {
public void submit( boolean win, Object cause ) {
load();
@@ -95,7 +95,7 @@ public enum Rankings {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
rec.date = format.format(new Date(Game.realTime));
rec.cause = cause;
rec.cause = cause instanceof Class ? (Class)cause : cause.getClass();
rec.win = win;
rec.heroClass = Dungeon.hero.heroClass;
rec.armorTier = Dungeon.hero.tier();

View File

@@ -486,7 +486,7 @@ public abstract class Char extends Actor {
|| this instanceof MirrorImage || this instanceof PrismaticImage){
Badges.validateDeathFromFriendlyMagic();
}
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
} else if (this == Dungeon.hero) {

View File

@@ -76,7 +76,7 @@ public class Electricity extends Blob {
if (cur[cell] % 2 == 1) {
ch.damage(Math.round(Random.Float(2 + Dungeon.scalingDepth() / 5f)), this);
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -72,7 +72,7 @@ public class ToxicGas extends Blob implements Hero.Doom {
Badges.validateDeathFromGas();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -120,7 +120,7 @@ public class Berserk extends Buff implements ActionIndicator.Action {
BuffIndicator.refreshHero();
if (!target.isAlive()){
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;
if (!target.isAlive()){
target.die(this);
if (!target.isAlive()) Dungeon.fail(this.getClass());
if (!target.isAlive()) Dungeon.fail(this);
}
}

View File

@@ -111,7 +111,7 @@ public class Bleeding extends Buff {
} else if (source == Sacrificial.class){
Badges.validateDeathFromFriendlyMagic();
}
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}

View File

@@ -224,7 +224,7 @@ public class Burning extends Buff implements Hero.Doom {
Badges.validateDeathFromFire();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -364,7 +364,7 @@ public class Combo extends Buff implements ActionIndicator.Action {
dist--;
}
}
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero.getClass());
WandOfBlastWave.throwChar(enemy, trajectory, dist, true, false, hero);
break;
case PARRY:
hit(enemy);

View File

@@ -121,7 +121,7 @@ public class Corrosion extends Buff implements Hero.Doom {
Badges.validateDeathFromFriendlyMagic();
}
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n(Messages.get(this, "ondeath"));
}

View File

@@ -198,7 +198,7 @@ public class Hunger extends Buff implements Hero.Doom {
Badges.validateDeathFromHunger();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -578,7 +578,7 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action {
//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);
//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) {
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
trajectory = new Ballistica(trajectory.collisionPos, trajectory.path.get(trajectory.path.size() - 1), Ballistica.PROJECTILE);
//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) {
Buff.affect(ch, Paralysis.class, Math.min( 6, trajectory.dist));

View File

@@ -88,7 +88,7 @@ public class Ooze extends Buff {
}
if (!target.isAlive() && target == Dungeon.hero) {
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
spend( TICK );

View File

@@ -117,7 +117,7 @@ public class Poison extends Buff implements Hero.Doom {
public void onDeath() {
Badges.validateDeathFromPoison();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -401,7 +401,7 @@ public class ElementalStrike extends ArmorAbility {
knockback,
true,
true,
ElementalStrike.this.getClass());
ElementalStrike.this);
}
//*** Lucky ***

View File

@@ -297,7 +297,7 @@ public class ElementalBlast extends ArmorAbility {
knockback,
true,
true,
ElementalBlast.this.getClass());
ElementalBlast.this);
}
//*** Wand of Frost ***

View File

@@ -103,7 +103,7 @@ public class HeroicLeap extends ArmorAbility {
if (mob.pos == hero.pos + i && hero.hasTalent(Talent.IMPACT_WAVE)){
Ballistica trajectory = new Ballistica(mob.pos, mob.pos + i, Ballistica.MAGIC_BOLT);
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)){
Buff.prolong(mob, Vulnerable.class, 5f);
}

View File

@@ -110,7 +110,7 @@ public class DM100 extends Mob implements Callback {
if (!enemy.isAlive()) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "zap_kill") );
}
}

View File

@@ -410,7 +410,7 @@ public class DM300 extends Mob {
if (Dungeon.level.adjacent(pos, target.pos)){
int oppositeAdjacent = target.pos + (target.pos - pos);
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){
Dungeon.hero.interrupt();
}
@@ -420,7 +420,7 @@ public class DM300 extends Mob {
} else if (fieldOfView[target.pos] && Dungeon.level.distance(pos, target.pos) == 2) {
int oppositeAdjacent = target.pos + (target.pos - pos);
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){
Dungeon.hero.interrupt();
}

View File

@@ -338,7 +338,7 @@ public abstract class Elemental extends Mob {
for (Char ch : affected) {
ch.damage( Math.round( damage * 0.4f ), Shocking.class );
if (ch == Dungeon.hero && !ch.isAlive()){
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
}
}

View File

@@ -195,7 +195,7 @@ public class Eye extends Mob {
if (!ch.isAlive() && ch == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "deathgaze_kill") );
}
} else {

View File

@@ -214,7 +214,7 @@ public class Necromancer extends Mob {
blocker.damage( Random.NormalIntRange(2, 10), this );
if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass());
Dungeon.fail(this);
}
}

View File

@@ -128,7 +128,7 @@ public abstract class Shaman extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "bolt_kill") );
}
} else {

View File

@@ -84,7 +84,7 @@ public class Skeleton extends Mob {
}
if (heroKilled) {
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "explo_kill") );
}
}

View File

@@ -137,7 +137,7 @@ public class SpectralNecromancer extends Necromancer {
blocker.damage( Random.NormalIntRange(2, 10), this );
if (blocker == Dungeon.hero && !blocker.isAlive()){
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass());
Dungeon.fail(this);
}
}

View File

@@ -137,7 +137,7 @@ public class Statue extends Mob {
damage = super.attackProc( enemy, damage );
damage = weapon.proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
}
return damage;

View File

@@ -121,7 +121,7 @@ public class Warlock extends Mob implements Callback {
if (enemy == Dungeon.hero && !enemy.isAlive()) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "bolt_kill") );
}
} else {

View File

@@ -244,7 +244,7 @@ public class YogDzewa extends Mob {
}
if (!ch.isAlive() && ch == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n(Messages.get(Char.class, "kill", name()));
}
} else {

View File

@@ -503,7 +503,7 @@ public abstract class YogFist extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(Char.class, "kill", name()) );
}
@@ -573,7 +573,7 @@ public abstract class YogFist extends Mob {
if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(Char.class, "kill", name()) );
}

View File

@@ -173,7 +173,7 @@ public class MirrorImage extends NPC {
if (hero.belongings.weapon() != null){
damage = hero.belongings.weapon().proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
}
return damage;

View File

@@ -53,7 +53,7 @@ public class Repulsion extends Armor.Glyph {
Math.round(2 * powerMulti),
true,
true,
getClass());
this);
}
return damage;

View File

@@ -161,7 +161,7 @@ public class Viscosity extends Glyph {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
spend( TICK );

View File

@@ -124,7 +124,7 @@ public class ChaliceOfBlood extends Artifact {
if (!hero.isAlive()) {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
} else {
upgrade();

View File

@@ -632,7 +632,7 @@ public class DriedRose extends Artifact {
if (rose != null && rose.weapon != null) {
damage = rose.weapon.proc( this, enemy, damage );
if (!enemy.isAlive() && enemy == Dungeon.hero){
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n( Messages.capitalize(Messages.get(Char.class, "kill", name())) );
}
}

View File

@@ -86,7 +86,7 @@ public class ArcaneBomb extends Bomb.MagicalBomb {
ch.damage(Math.round(damage*multiplier), this);
if (ch == Dungeon.hero && !ch.isAlive()){
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail(Bomb.class);
Dungeon.fail(this);
}
}
}

View File

@@ -197,7 +197,7 @@ public class Bomb extends Item {
Badges.validateDeathFromFriendlyMagic();
}
GLog.n(Messages.get(this, "ondeath"));
Dungeon.fail(Bomb.class);
Dungeon.fail(this);
}
}

View File

@@ -73,7 +73,7 @@ public class ShrapnelBomb extends Bomb {
damage -= ch.drRoll();
ch.damage(damage, this);
if (ch == Dungeon.hero && !ch.isAlive()) {
Dungeon.fail(Bomb.class);
Dungeon.fail(this);
}
}
}

View File

@@ -68,7 +68,7 @@ public class ScrollOfPsionicBlast extends ExoticScroll {
readAnimation();
} else {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}

View File

@@ -40,7 +40,7 @@ public class AquaBlast extends TargetedSpell {
GeyserTrap geyser = new GeyserTrap();
geyser.pos = cell;
geyser.source = getClass();
geyser.source = this;
if (bolt.path.size() > bolt.dist+1) {
geyser.centerKnockBackDirection = bolt.path.get(bolt.dist + 1);
}

View File

@@ -223,11 +223,11 @@ public class CursedWand {
if (!toDamage.isAlive()) {
if (user == Dungeon.hero && origin != null) {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( origin.getClass() );
Dungeon.fail( origin );
GLog.n( Messages.get( CursedWand.class, "ondeath", origin.name() ) );
} else {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail( toHeal.getClass() );
Dungeon.fail( toHeal );
}
}
} else {

View File

@@ -90,7 +90,7 @@ public class WandOfBlastWave extends DamageWand {
if (ch.pos == bolt.collisionPos + i) {
Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT);
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) {
Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT);
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,
boolean closeDoors, boolean collideDmg, Class cause){
boolean closeDoors, boolean collideDmg, Object cause){
if (ch.properties().contains(Char.Property.BOSS)) {
power = (power+1)/2;
}
@@ -165,7 +165,7 @@ public class WandOfBlastWave extends DamageWand {
if (ch.isActive()) {
Paralysis.prolong(ch, Paralysis.class, 1 + finalDist/2f);
} else if (ch == Dungeon.hero){
if (cause == WandOfBlastWave.class || cause == AquaBlast.class){
if (cause instanceof WandOfBlastWave || cause instanceof AquaBlast){
Badges.validateDeathFromFriendlyMagic();
}
Dungeon.fail(cause);

View File

@@ -86,7 +86,7 @@ public class WandOfLightning extends DamageWand {
ch.damage(Math.round(damageRoll() * multiplier * 0.5f), this);
if (!curUser.isAlive()) {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n(Messages.get(this, "ondeath"));
}
} else {

View File

@@ -133,7 +133,7 @@ public class WandOfTransfusion extends Wand {
if (!curUser.isAlive()){
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -339,7 +339,7 @@ public class WandOfWarding extends Wand {
if (!enemy.isAlive() && enemy == Dungeon.hero) {
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail( getClass() );
Dungeon.fail( this );
}
totalZaps++;

View File

@@ -56,7 +56,7 @@ public class Elastic extends Weapon.Enchantment {
Math.round(2 * powerMulti),
!(weapon instanceof MissileWeapon || weapon instanceof SpiritBow),
true,
getClass());
this);
}
return damage;

View File

@@ -95,7 +95,7 @@ public class Spear extends MeleeWeapon {
//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);
//knock them back along that ballistica
WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero.getClass());
WandOfBlastWave.throwChar(enemy, trajectory, 1, true, false, hero);
} else {
wep.onAbilityKill(hero, enemy);
}

View File

@@ -74,7 +74,7 @@ public class ForceCube extends MissileWeapon {
curUser.shoot(target, this);
if (target == Dungeon.hero && !target.isAlive()){
Badges.validateDeathFromFriendlyMagic();
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n(Messages.get(this, "ondeath"));
}
}

View File

@@ -281,7 +281,7 @@ public class SentryRoom extends SpecialRoom {
Dungeon.hero.damage(Random.NormalIntRange(2 + Dungeon.depth / 2, 4 + Dungeon.depth), new Eye.DeathGaze());
if (!Dungeon.hero.isAlive()) {
Badges.validateDeathFromEnemyMagic();
Dungeon.fail(getClass());
Dungeon.fail(this);
GLog.n(Messages.capitalize(Messages.get(Char.class, "kill", name())));
}
} else {

View File

@@ -79,7 +79,7 @@ public class DisintegrationTrap extends Trap {
Hero hero = (Hero)target;
if (!hero.isAlive()){
Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -46,7 +46,7 @@ public class GeyserTrap extends Trap {
}
public int centerKnockBackDirection = -1;
public Class source = getClass();
public Object source = this;
@Override
public void activate() {

View File

@@ -100,7 +100,7 @@ public class GrimTrap extends Trap {
Sample.INSTANCE.play(Assets.Sounds.CURSED);
if (!finalTarget.isAlive()) {
Badges.validateDeathFromGrimOrDisintTrap();
Dungeon.fail( GrimTrap.this.getClass() );
Dungeon.fail( GrimTrap.this );
GLog.n( Messages.get(GrimTrap.class, "ondeath") );
}
} else {

View File

@@ -104,7 +104,7 @@ public class PoisonDartTrap extends Trap {
Statistics.bossScores[1] -= 100;
}
if (!finalTarget.isAlive()) {
Dungeon.fail(PoisonDartTrap.this.getClass());
Dungeon.fail(PoisonDartTrap.this);
}
}
Buff.affect( finalTarget, Poison.class ).set( poisonAmount() );

View File

@@ -101,7 +101,7 @@ public class RockfallTrap extends Trap {
Buff.prolong( ch, Paralysis.class, Paralysis.DURATION );
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail( getClass() );
Dungeon.fail( this );
GLog.n( Messages.get(this, "ondeath") );
}
}

View File

@@ -83,7 +83,7 @@ public class WornDartTrap extends Trap {
int dmg = Random.NormalIntRange(4, 8) - finalTarget.drRoll();
finalTarget.damage(dmg, WornDartTrap.this);
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));
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);