Gen7Data/Scripts/Moves/Drain.as

20 lines
695 B
ActionScript

namespace Gen7 {
[Move effect=drain]
shared class DrainMove : PkmnScript{
private float _healModifier = 0;
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override {
_healModifier = parameters[0].AsFloat();
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
auto hitData = attack.GetHitData(target, hit);
auto damage = hitData.Damage;
float mod = _healModifier;
if (attack.User.HasHeldItem("big_root")){
mod *= 1.3;
}
attack.User.Heal(uint(damage * mod));
}
}
}