Adds Arena Trap ability

This commit is contained in:
Deukhoofd 2021-11-20 14:43:13 +01:00
parent f19c60c4c1
commit baae9377ef
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,15 @@
namespace Gen7 {
class ArenaTrap : PkmnScript {
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool &inout block){
if (block) return;
if (SpecialStates::IsRaised(choice.User)) return;
block = true;
}
void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool &inout block){
if (block) return;
if (SpecialStates::IsRaised(choice.User)) return;
block = true;
}
}
}

View File

@ -26,6 +26,7 @@ type Pokemon {
void SetHeldItem(const Item@ item); void SetHeldItem(const Item@ item);
string Nickname { get const; }; string Nickname { get const; };
bool HasType(uint8 type) const; bool HasType(uint8 type) const;
bool HasType(const constString &in type) const;
void Damage(uint type, DamageSource source); void Damage(uint type, DamageSource source);
void Heal(uint type); void Heal(uint type);
void OverrideActiveAbility(const string &in ability); void OverrideActiveAbility(const string &in ability);
@ -34,7 +35,7 @@ type Pokemon {
uint GetBoostedStat(Statistic stat) const; uint GetBoostedStat(Statistic stat) const;
uint GetBaseStat(Statistic stat) const; uint GetBaseStat(Statistic stat) const;
int8 GetStatBoost(Statistic stat) const; int8 GetStatBoost(Statistic stat) const;
bool HasVolatile(const constString &in name); bool HasVolatile(const constString &in name) const;
ref@ AddVolatile(const constString &in name); ref@ AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const; void RemoveVolatile(const constString &in name) const;
void ClearStatus() const; void ClearStatus() const;

View File

@ -0,0 +1,5 @@
namespace Gen7 {
// Empty class to tag the Pokemon as raised up.
[Pokemon effect=RaisedUp]
class RaisedUp : PkmnScript {}
}

View File

@ -0,0 +1,14 @@
namespace Gen7 {
namespace SpecialStates {
bool IsRaised(const Pokemon@ pokemon){
if (pokemon.HasType("flying")){
return true;
}
if (pokemon.HasVolatile("RaisedUp")){
return true;
}
return false;
}
}
}