This commit is contained in:
18
Scripts/Abilities/Aftermath.as
Normal file
18
Scripts/Abilities/Aftermath.as
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace Gen7 {
|
||||
[Ability effect=Aftermath]
|
||||
class Aftermath : PkmnScript {
|
||||
void OnFaint(Pokemon@ mon, DamageSource source) override {
|
||||
// If the mon fainted due to something that was not a move, ignore
|
||||
if (source != DamageSource::AttackDamage){
|
||||
return;
|
||||
}
|
||||
// Last used attack on the target should always be the move that caused the faint if the source is AttackDamage
|
||||
auto lastMoveEvent = mon.Battle.History.GetLastUsedAttackOnTarget(mon, 1);
|
||||
// Check if the move is a contact move
|
||||
if (lastMoveEvent.Move.UseMove.HasFlag("contact")){
|
||||
// Damage by 1/4th of the mon's max HP.
|
||||
lastMoveEvent.Move.User.Damage(lastMoveEvent.Move.User.MaxHealth / 4, DamageSource::Misc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Scripts/Abilities/Analytic.as
Normal file
15
Scripts/Abilities/Analytic.as
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Gen7 {
|
||||
[Ability effect=Analytic]
|
||||
class Analytic : PkmnScript {
|
||||
void OverrideBasePower(ExecutingMove@ move, Pokemon@, uint8, uint8 &inout damage) override {
|
||||
// If the turnqueue of the battle is empty now, we don't have any choices to execute after this.
|
||||
// This means this is the last move in the turn.
|
||||
if (!move.User.Battle.TurnQueue.HasNext()){
|
||||
float expectedDamage = damage;
|
||||
expectedDamage *= 1.3f;
|
||||
if (expectedDamage > 255) expectedDamage = 255;
|
||||
damage = uint8(expectedDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Scripts/Abilities/AngerPoint.as
Normal file
9
Scripts/Abilities/AngerPoint.as
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Gen7 {
|
||||
class AngerPoint : PkmnScript {
|
||||
void OnIncomingHit(ExecutingMove@ move, Pokemon@ target, uint8 hit) override {
|
||||
if (move.GetHitData(target, hit).IsCritical){
|
||||
target.ChangeStatBoost(Statistic::Attack, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Scripts/Abilities/ChangeMoveType.as
Normal file
31
Scripts/Abilities/ChangeMoveType.as
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace Gen7 {
|
||||
[Ability effect=ChangeMoveType]
|
||||
class ChangeMoveType : PkmnScript {
|
||||
string _fromType;
|
||||
string _toType;
|
||||
bool _changedLastAttack = false;
|
||||
|
||||
void OnInitialize(const narray<EffectParameter@>@ parameters) override {
|
||||
_fromType = parameters[0].AsString();
|
||||
_toType = 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);
|
||||
_changedLastAttack = true;
|
||||
}
|
||||
else{
|
||||
_changedLastAttack = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyDamageModifier(ExecutingMove@, Pokemon@, uint8, float &inout damageMod) override {
|
||||
if (_changedLastAttack){
|
||||
damageMod *= 1.2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Scripts/Abilities/IncreasedSTAB.as
Normal file
10
Scripts/Abilities/IncreasedSTAB.as
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Gen7 {
|
||||
[Ability effect=IncreasedStab]
|
||||
class IncreasedStab : PkmnScript {
|
||||
void OverrideSTABModifier(ExecutingMove@ move, Pokemon@ target, uint8 hit, float &inout stabMod) override {
|
||||
if (move.User.HasType(move.GetHit(target, hit).Type)){
|
||||
stabMod = 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
15
Scripts/Abilities/SuppressWeather.as
Normal file
15
Scripts/Abilities/SuppressWeather.as
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Gen7 {
|
||||
class SuppressWeatherAbility : PkmnScript {
|
||||
void OnSwitchIn(Pokemon@ pokemon) override {
|
||||
pokemon.Battle.SuppressWeather();
|
||||
pokemon.Battle.AddVolatile("SuppressWeather");
|
||||
};
|
||||
|
||||
void OnRemove() override {
|
||||
auto battle = cast<Pokemon@>(GetOwner()).Battle;
|
||||
battle.UnsuppressWeather();
|
||||
auto script = cast<SuppressWeather>(battle.GetVolatile("SuppressWeather"));
|
||||
script.Unstack();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user