Skip to content

Instantly share code, notes, and snippets.

@DoctorGester
Created December 25, 2023 21:04
Show Gist options
  • Save DoctorGester/2f4f17ea49c5fa94c59037df75d92b8a to your computer and use it in GitHub Desktop.
Save DoctorGester/2f4f17ea49c5fa94c59037df75d92b8a to your computer and use it in GitHub Desktop.
ability(AbilityId.TopHat, {
projectileSpeed: 850,
damage: [100, 150, 200, 250, 300],
slow: 50,
slowDuration: [4.0, 4.5, 5.0, 5.5, 6.0]
}, ability => {
const slow = modifier<number>(modifier => {
modifier.changes((change, slow) => {
change.property(UnitProperty.moveSpeed, slow);
});
});
ability.action("unitTarget", {
manaCost: [100, 125, 150, 175, 200],
cooldown: 20,
castPoint: 0.3,
castRange: 750,
targets: [ActionTarget.enemy]
}, ({ ability, onCast }) => {
onCast(async ({ caster, target }) => {
const projectile = await launchProjectile(ability, {
kind: "unit",
at: caster.position,
target,
speed: ability.value("projectileSpeed"),
particle: Particle.TopHatProjectile
});
if (projectile.hit) {
dealDamage(ability, projectile.target, { damage: ability.value("damage"), type: DamageType.magical });
slow.apply(caster, ability, projectile.target, ability.value("slowDuration"), -ability.value("slow"));
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment