Skip to content

Commit

Permalink
Added Explosive Death upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicFrog committed Jul 4, 2022
1 parent 244aa63 commit 1e2574f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.6.2

- New: Explosive Death upgrade causes slain enemies to detonate.
- Change: Acid tree rework
- Explosive Reaction removed
- Acid Spray upgraded to mastery; splash radius doubled
Expand Down
6 changes: 6 additions & 0 deletions NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ INCOMBAT (strife flag used for the dialogue system)

Ended up going with +INCOMBAT, but that's an imperfect solution if we want *different* upgrades to be able to chain off each other, e.g. the fragments from fragmentation shots applying poison; we may want a way to restrict *which* upgrades individual upgrades can trigger, with a default that blocks recursion but not non-recursive chaining -- say, if an actor has the name TFLV::Upgrade::Foo:Aux, it can't trigger anything in TFLV::Upgrade::Foo but other stuff in the Upgrade namespace is fair game.

Better idea: use the `master` pointer in auxes and dots -- basically anything we'd set +INCOMBAT on -- to point to the upgrade that created it. Then we can assign a priority to each upgrade and only higher-priority ones can trigger lower-priority effects.

At the moment, this probably means that ExplosiveDeath, ExplosiveShots, and FragmentationShots are PRI_SECONDARY_DAMAGE or so, and all the elemental upgrades are PRI_ELEMENTAL, which is lower.

Then in UpgradeBag event handlers, rather than checking +INCOMBAT, we check if the master point is set and castable to upgrade; if so, we compare its priority to the priority of the upgrade we're about to trigger.

## OnApply() based mods

This is stuff like knockback, increased health, etc that requires making a permanent change to the player or the weapon.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Killing an enemy grants you health and armour equal to 5% of its max health. Unl

As a player upgrade, increases *all* damage you deal by 5% per level. As a weapon upgrade, increases damage dealt by *that weapon* by 10% per level. In either case it will always add at least one point of damage per level to each of your attacks.

### Explosive Death *(Ranged only)*

Killing an enemy causes an explosion dealing 20% of (its health + the amount you overkilled it by). Increasing the level increases the damage (with diminishing returns), increases the blast radius (linearly), and reduces the damage you take from the blast.

### Explosive Shots *(Hitscan only)*

Creates a small explosion on hit doing 40% of the original attack damage. More levels increase the damage and blast radius, and reduce the damage you take from your own explosions.
Expand Down Expand Up @@ -177,6 +181,8 @@ Lower-rank skills are required to have more levels than higher-rank ones, so to

Each weapon can only have two different elements on it. When you choose your first elemental upgrade, that element is "locked in" until you choose a mastery upgrade for it. At that point you can (if you wish) choose a second element next time it levels up.

Note that unlike the non-elemental upgrades, elemental AoE effects like `Acid Splash` and `Putrefaction` will never harm the player.

## Fire

Fire does more damage the more health the target has, and "burns out" once they're below 50% health. If an enemy that has "burned out" heals, it will start taking fire damage again, making this particularly effective against modded enemies with regeneration or self-healing. More stacks cause it to do the damage faster (but do not increase the total damage dealt). Once an enemy has fire stacks it never loses them; they just become dormant once it drops below the health threshold.
Expand Down
43 changes: 43 additions & 0 deletions ca.ancilla.laevis/upgrades/ExplosiveDeath.zs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#namespace TFLV::Upgrade;
#debug off

class ::ExplosiveDeath : ::BaseUpgrade {
override void OnKill(Actor player, Actor shot, Actor target) {
let aux = ::ExplosiveDeath::Aux(target.Spawn("::ExplosiveDeath::Aux", target.pos));
aux.target = player;
aux.level = level;
aux.power = (target.SpawnHealth() + abs(target.health)) * (1.0 - 0.8 ** level);
DEBUG("Created explosion: level=%d power=%d overkill=%d",
aux.level, aux.power, abs(target.health));
}

override bool IsSuitableForWeapon(TFLV::WeaponInfo info) {
return !info.weapon.bMELEEWEAPON;
}
}

class ::ExplosiveDeath::Aux : Actor {
uint level;
uint power;

Default {
DamageType "Extreme";
+NOBLOCKMAP;
+NOGRAVITY;
+INCOMBAT; // Laevis recursion guard
}

override int DoSpecialDamage(Actor target, int damage, Name damagetype) {
if (target == self.target) {
return damage * (0.5 ** self.level);
}
return damage;
}

States {
Spawn:
LEXP B 7 Bright NoDelay A_Explode(power, 64 + level*32, XF_HURTSOURCE, false, level*16);
LEXP CD 7 Bright;
STOP;
}
}
1 change: 1 addition & 0 deletions ca.ancilla.laevis/upgrades/Registry.zs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ::Registry : Object play {
// "::Beam", TODO: fix interactions with HE shots and similar
"::BouncyShots",
"::DarkHarvest",
"::ExplosiveDeath",
"::ExplosiveShots",
"::FastShots",
"::FragmentationShots",
Expand Down
1 change: 1 addition & 0 deletions ca.ancilla.laevis/upgrades/main.zs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "./Beam.zsc"
#include "./Explosive.zsc"
#include "./ExplosiveDeath.zsc"
#include "./Fragmentation.zsc"
#include "./HomingShots.zsc"
#include "./Leech.zsc"
Expand Down

0 comments on commit 1e2574f

Please sign in to comment.