2021-11-19 17:12:10 +00:00
|
|
|
namespace Gen7 {
|
|
|
|
[Ability effect=ChangeMoveType]
|
|
|
|
class ChangeMoveType : PkmnScript {
|
2022-02-12 16:47:59 +00:00
|
|
|
uint8 _fromType;
|
|
|
|
uint8 _toType;
|
2021-11-19 17:12:10 +00:00
|
|
|
bool _changedLastAttack = false;
|
|
|
|
|
2022-02-12 16:47:59 +00:00
|
|
|
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 {
|
2022-02-12 16:47:59 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|