Gen7Data/Scripts/Moves/Drain.as

20 lines
667 B
ActionScript
Raw Normal View History

2021-03-28 18:22:46 +00:00
namespace Gen7 {
2020-04-10 22:23:17 +00:00
[Move effect=drain]
shared class DrainMove : PkmnScript{
private float _healModifier = 0;
2021-03-28 18:22:46 +00:00
void OnInitialize(const array<EffectParameter@> &in parameters) override {
2020-04-10 22:23:17 +00:00
_healModifier = parameters[0].AsFloat();
}
2021-03-28 18:22:46 +00:00
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
auto hitData = attack.GetHitData(target, hit);
2020-04-10 22:23:17 +00:00
auto damage = hitData.Damage;
float mod = _healModifier;
if (attack.User.HasHeldItem("big_root")){
mod *= 1.3;
}
attack.User.Heal(uint(damage * mod));
}
}
2021-03-28 18:22:46 +00:00
}