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": {
"effect": "BattleBond"
},
"beast_boost": {},
"berserk": {},
"big_pecks": {},
"blaze": {},
"bulletproof": {},
"cheek_pouch": {},
"beast_boost": {
"effect": "BeastBoost"
},
"berserk": {
"effect": "Berserk"
},
"big_pecks": {
"effect": "PreventDefLowering"
},
"blaze": {
"effect": "PowerUpType",
"parameters": ["fire"]
},
"bulletproof": {
"effect": "Bulletproof"
},
"cheek_pouch": {
},
"chlorophyll": {},
"clear_body": {},
"cloud_nine": {},

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;
}
}
}
}

View File

@ -2,7 +2,7 @@ shared abstract class PkmnScript {
ref@ __owner;
ref@& GetOwner(){ return __owner; };
void OnInitialize(const narray<EffectParameter@>@){};
void OnInitialize(const BattleLibrary@, const narray<EffectParameter@>@){};
void Stack(){};
void OnRemove(){};
void OnBeforeTurn(BaseTurnChoice@){};
@ -20,6 +20,8 @@ shared abstract class PkmnScript {
void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){};
void OnIncomingHit(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 OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){};
void OnAfterHits(ExecutingMove@, Pokemon@){};
@ -51,4 +53,6 @@ shared abstract class PkmnScript {
void DoesShareExperience(Pokemon@, Pokemon@, bool &inout){};
void BlockWeather(Battle@, bool &inout){};
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{
int8 _amount;
void OnInitialize(const narray<EffectParameter@>@ parameters) override{
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt());
}

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class DrainMove : PkmnScript{
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();
}

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class HealEachEndOfTurn : PkmnScript {
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;
}