Gen7Data/Scripts/Abilities/ChangeMoveType.as

30 lines
1008 B
ActionScript
Raw Permalink Normal View History

2021-11-19 17:12:10 +00:00
namespace Gen7 {
[Ability effect=ChangeMoveType]
class ChangeMoveType : PkmnScript {
uint8 _fromType;
uint8 _toType;
2021-11-19 17:12:10 +00:00
bool _changedLastAttack = false;
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override {
auto lib = library.StaticLibrary.TypeLibrary;
_fromType = lib.GetTypeId(parameters[0].AsString());
_toType = lib.GetTypeId(parameters[1].AsString());
2021-11-19 17:12:10 +00:00
}
void ChangeAttackType(ExecutingMove@ move, Pokemon@ target, uint8 hit, uint8 &inout t) override {
if (_fromType == t){
t = _toType;
2021-11-19 17:12:10 +00:00
_changedLastAttack = true;
}
else{
_changedLastAttack = false;
}
}
void ModifyDamageModifier(ExecutingMove@, Pokemon@, uint8, float &inout damageMod) override {
if (_changedLastAttack){
damageMod *= 1.2f;
}
}
}
}