Implements beastboost, berserk, big pecks, blaze, and bulletproof abilities
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-02-12 17:47:59 +01:00
parent 01ffed96f5
commit 92edafc6fb
15 changed files with 77 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
namespace Gen7 {
[Ability effect=BeastBoost]
class BeastBoost : PkmnScript {
void OnFaintingOpponent(ExecutingMove@ move, Pokemon@, uint8) override {
Statistic increaseStat = Statistic::HP;

View File

@@ -1,4 +1,5 @@
namespace Gen7 {
[Ability effect=Berserk]
class Berserk : PkmnScript {
void OnDamage(Pokemon@ pokemon, DamageSource, uint old, uint new) override {
if (float(old) / pokemon.MaxHealth >= 0.5f && float(new) / pokemon.MaxHealth < 0.5f) {

View File

@@ -0,0 +1,10 @@
namespace Gen7 {
[Ability effect=Bulletproof]
class Bulletproof : PkmnScript {
void IsInvulnerable(ExecutingMove@ move, Pokemon@, bool &inout isInvulnerable) {
if (move.UseMove.HasFlag("ballistics")){
isInvulnerable = true;
}
}
}
}

View File

@@ -1,20 +1,19 @@
namespace Gen7 {
[Ability effect=ChangeMoveType]
class ChangeMoveType : PkmnScript {
string _fromType;
string _toType;
uint8 _fromType;
uint8 _toType;
bool _changedLastAttack = false;
void OnInitialize(const narray<EffectParameter@>@ parameters) override {
_fromType = parameters[0].AsString();
_toType = parameters[1].AsString();
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());
}
void ChangeAttackType(ExecutingMove@ move, Pokemon@ target, uint8 hit, uint8 &inout t) override {
auto lib = move.User.Battle.Library.StaticLibrary.TypeLibrary;
auto fromTypeId = lib.GetTypeId(_fromType);
if (fromTypeId == t){
t = lib.GetTypeId(_toType);
if (_fromType == t){
t = _toType;
_changedLastAttack = true;
}
else{

View File

@@ -0,0 +1,16 @@
namespace Gen7 {
[Ability effect=PowerUpType]
class PowerUpTypeAbility : PkmnScript {
uint8 _typeId;
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters){
_typeId = library.StaticLibrary.TypeLibrary.GetTypeId(parameters[0].AsString());
}
void ModifyOffensiveStatValue(ExecutingMove@ move, Pokemon@ target, uint8, float &inout value) override {
if (move.Move.MoveData.Type == _typeId){
value *= 1.5f;
}
}
}
}

View File

@@ -0,0 +1,10 @@
namespace Gen7 {
[Ability effect=PreventDefLowering]
class PreventDefLowering : PkmnScript {
void PreventStatBoostChange(Pokemon@, Statistic stat, int8 amount, bool &inout prevent) override {
if (stat == Statistic::Defense && amount < 0) {
prevent = true;
}
}
}
}