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

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

View File

@ -42,12 +42,25 @@
"battle_bond": { "battle_bond": {
"effect": "BattleBond" "effect": "BattleBond"
}, },
"beast_boost": {}, "beast_boost": {
"berserk": {}, "effect": "BeastBoost"
"big_pecks": {}, },
"blaze": {}, "berserk": {
"bulletproof": {}, "effect": "Berserk"
"cheek_pouch": {}, },
"big_pecks": {
"effect": "PreventDefLowering"
},
"blaze": {
"effect": "PowerUpType",
"parameters": ["fire"]
},
"bulletproof": {
"effect": "Bulletproof"
},
"cheek_pouch": {
},
"chlorophyll": {}, "chlorophyll": {},
"clear_body": {}, "clear_body": {},
"cloud_nine": {}, "cloud_nine": {},

View File

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

View File

@ -1,4 +1,5 @@
namespace Gen7 { namespace Gen7 {
[Ability effect=Berserk]
class Berserk : PkmnScript { class Berserk : PkmnScript {
void OnDamage(Pokemon@ pokemon, DamageSource, uint old, uint new) override { void OnDamage(Pokemon@ pokemon, DamageSource, uint old, uint new) override {
if (float(old) / pokemon.MaxHealth >= 0.5f && float(new) / pokemon.MaxHealth < 0.5f) { 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 { namespace Gen7 {
[Ability effect=ChangeMoveType] [Ability effect=ChangeMoveType]
class ChangeMoveType : PkmnScript { class ChangeMoveType : PkmnScript {
string _fromType; uint8 _fromType;
string _toType; uint8 _toType;
bool _changedLastAttack = false; bool _changedLastAttack = false;
void OnInitialize(const narray<EffectParameter@>@ parameters) override { void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override {
_fromType = parameters[0].AsString(); auto lib = library.StaticLibrary.TypeLibrary;
_toType = parameters[1].AsString(); _fromType = lib.GetTypeId(parameters[0].AsString());
_toType = lib.GetTypeId(parameters[1].AsString());
} }
void ChangeAttackType(ExecutingMove@ move, Pokemon@ target, uint8 hit, uint8 &inout t) override { void ChangeAttackType(ExecutingMove@ move, Pokemon@ target, uint8 hit, uint8 &inout t) override {
auto lib = move.User.Battle.Library.StaticLibrary.TypeLibrary; if (_fromType == t){
auto fromTypeId = lib.GetTypeId(_fromType); t = _toType;
if (fromTypeId == t){
t = lib.GetTypeId(_toType);
_changedLastAttack = true; _changedLastAttack = true;
} }
else{ 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;
}
}
}
}

View File

@ -2,7 +2,7 @@ shared abstract class PkmnScript {
ref@ __owner; ref@ __owner;
ref@& GetOwner(){ return __owner; }; ref@& GetOwner(){ return __owner; };
void OnInitialize(const narray<EffectParameter@>@){}; void OnInitialize(const BattleLibrary@, const narray<EffectParameter@>@){};
void Stack(){}; void Stack(){};
void OnRemove(){}; void OnRemove(){};
void OnBeforeTurn(BaseTurnChoice@){}; void OnBeforeTurn(BaseTurnChoice@){};
@ -20,6 +20,8 @@ shared abstract class PkmnScript {
void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){};
void OnIncomingHit(ExecutingMove@, Pokemon@, uint8){}; void OnIncomingHit(ExecutingMove@, Pokemon@, uint8){};
void OnFaintingOpponent(ExecutingMove@, Pokemon@, uint8){}; void OnFaintingOpponent(ExecutingMove@, Pokemon@, uint8){};
void PreventStatBoostChange(Pokemon@, Statistic, int8, bool &inout){};
void ModifyStatBoostChange(Pokemon@, Statistic, int8 &inout){};
void PreventSecondaryEffects(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void PreventSecondaryEffects(ExecutingMove@, Pokemon@, uint8, bool &inout){};
void OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){}; void OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){};
void OnAfterHits(ExecutingMove@, Pokemon@){}; void OnAfterHits(ExecutingMove@, Pokemon@){};
@ -51,4 +53,6 @@ shared abstract class PkmnScript {
void DoesShareExperience(Pokemon@, Pokemon@, bool &inout){}; void DoesShareExperience(Pokemon@, Pokemon@, bool &inout){};
void BlockWeather(Battle@, bool &inout){}; void BlockWeather(Battle@, bool &inout){};
void OnSwitchIn(Pokemon@){}; void OnSwitchIn(Pokemon@){};
void ModifyOffensiveStatValue(ExecutingMove@, Pokemon@, uint8, float &inout){};
void ModifyDefensiveStatValue(ExecutingMove@, Pokemon@, uint8, float &inout){};
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
class ChangeAllTargetStats : PkmnScript{ class ChangeAllTargetStats : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
class ChangeTargetAttack : PkmnScript{ class ChangeTargetAttack : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetDefense : PkmnScript{ shared class ChangeTargetDefense : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetSpecialDefense : PkmnScript{ shared class ChangeTargetSpecialDefense : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetSpeed : PkmnScript{ shared class ChangeTargetSpeed : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class DrainMove : PkmnScript{ shared class DrainMove : PkmnScript{
private float _healModifier = 0; private float _healModifier = 0;
void OnInitialize(const narray<EffectParameter@>@ parameters) override { void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override {
_healModifier = parameters[0].AsFloat(); _healModifier = parameters[0].AsFloat();
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class HealEachEndOfTurn : PkmnScript { shared class HealEachEndOfTurn : PkmnScript {
float _amount; float _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{ void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = float(parameters[0].AsFloat()) / 100; _amount = float(parameters[0].AsFloat()) / 100;
} }