Fixes for struggle

This commit is contained in:
Deukhoofd 2021-04-16 14:53:35 +02:00
parent 82ac1061fa
commit 76f62d6c2d
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 20 additions and 15 deletions

View File

@ -6877,17 +6877,6 @@
"category": "status", "category": "status",
"flags": ["protect", "reflectable", "mirror"] "flags": ["protect", "reflectable", "mirror"]
}, },
{
"name": "struggle",
"type": "normal",
"power": 50,
"pp": 255,
"accuracy": 0,
"priority": 0,
"target": "RandomOpponent",
"category": "physical",
"flags": ["contact", "protect"]
},
{ {
"name": "struggle_bug", "name": "struggle_bug",
"type": "bug", "type": "bug",

View File

@ -1,8 +1,24 @@
namespace Gen7 { namespace Gen7 {
[Move effect=Struggle] [Move effect=Struggle]
shared class Struggle : PkmnScript { class Struggle : PkmnScript {
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{ void ChangeEffectiveness(ExecutingMove@, Pokemon@, uint8, float &inout eff) override {
attack.User.Damage(uint(attack.User.MaxHealth / 4), DamageSource::Struggle); eff = 1;
} }
void IsInvulnerable(ExecutingMove@, Pokemon@, bool &inout invul) override {
invul = false;
} }
void ModifyNumberOfHits(MoveTurnChoice@, uint8 &inout hitcount) override {
hitcount = 1;
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@, uint8) override {
auto damage = uint(attack.User.MaxHealth / 4);
if (damage == 0){
damage = 1;
}
attack.User.Damage(damage, DamageSource::Struggle);
}
};
} }