Adds Ability Hospitality (#3818)

* Adds Ability Hospitality

* fix agbcc
This commit is contained in:
Alex 2023-12-25 01:43:57 +01:00 committed by GitHub
parent 58b03cb3bd
commit 1339256d5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 1 deletions

View file

@ -8853,6 +8853,16 @@ BattleScript_ZeroToHeroActivates::
waitmessage B_WAIT_TIME_LONG
end3
BattleScript_HospitalityActivates::
pause B_WAIT_TIME_SHORT
call BattleScript_AbilityPopUp
printstring STRINGID_HOSPITALITYRESTORATION
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
end3
BattleScript_AttackWeakenedByStrongWinds::
pause B_WAIT_TIME_SHORT
printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS

View file

@ -461,6 +461,7 @@ extern const u8 BattleScript_CudChewActivates[];
extern const u8 BattleScript_SupremeOverlordActivates[];
extern const u8 BattleScript_CostarActivates[];
extern const u8 BattleScript_ZeroToHeroActivates[];
extern const u8 BattleScript_HospitalityActivates[];
extern const u8 BattleScript_ToxicDebrisActivates[];
extern const u8 BattleScript_EarthEaterActivates[];
extern const u8 BattleScript_MimicryActivates_End3[];

View file

@ -696,8 +696,9 @@
#define STRINGID_SWAMPENVELOPEDSIDE 694
#define STRINGID_THESWAMPDISAPPEARED 695
#define STRINGID_PKMNTELLCHILLINGRECEPTIONJOKE 696
#define STRINGID_HOSPITALITYRESTORATION 697
#define BATTLESTRINGS_COUNT 697
#define BATTLESTRINGS_COUNT 698
// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,

View file

@ -833,9 +833,11 @@ static const u8 sText_HurtByTheSeaOfFire[] = _("{B_ATK_TEAM1} {B_ATK_NAME_WITH_P
static const u8 sText_TheSeaOfFireDisappeared[] = _("The sea of fire around {B_ATK_TEAM2}\nteam disappeared!");
static const u8 sText_SwampEnvelopedSide[] = _("A swamp enveloped\n{B_DEF_TEAM2} team!");
static const u8 sText_TheSwampDisappeared[] = _("The swamp around {B_ATK_TEAM2}\nteam disappeared!");
static const u8 sText_HospitalityRestoration[] = _("The {B_ATK_PARTNER_NAME} drank down all\nthe matcha that Sinistcha made!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_HOSPITALITYRESTORATION - BATTLESTRINGS_TABLE_START] = sText_HospitalityRestoration,
[STRINGID_THESWAMPDISAPPEARED - BATTLESTRINGS_TABLE_START] = sText_TheSwampDisappeared,
[STRINGID_SWAMPENVELOPEDSIDE - BATTLESTRINGS_TABLE_START] = sText_SwampEnvelopedSide,
[STRINGID_THESEAOFFIREDISAPPEARED - BATTLESTRINGS_TABLE_START] = sText_TheSeaOfFireDisappeared,

View file

@ -4314,6 +4314,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
u32 moveType, move;
u32 side;
u32 i, j;
u32 partner, partnerMaxHP;
struct Pokemon *mon;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
@ -4922,6 +4923,19 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
effect++;
}
break;
case ABILITY_HOSPITALITY:
partner = BATTLE_PARTNER(battler);
partnerMaxHP = GetNonDynamaxMaxHP(partner);
if (!gSpecialStatuses[battler].switchInAbilityDone && IsDoubleBattle() && gBattleMons[partner].hp < partnerMaxHP)
{
gBattlerTarget = partner;
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
gBattleMoveDamage = (partnerMaxHP / 4) * -1;
BattleScriptPushCursorAndCallback(BattleScript_HospitalityActivates);
effect++;
}
break;
}
break;
case ABILITYEFFECT_ENDTURN: // 1

View file

@ -0,0 +1,70 @@
#include "global.h"
#include "test/battle.h"
DOUBLE_BATTLE_TEST("Hospitality user restores 25% of ally's health")
{
s16 health;
PARAMETRIZE { health = 75; }
PARAMETRIZE { health = 100; }
GIVEN {
PLAYER(SPECIES_POLTCHAGEIST) { Ability(ABILITY_HOSPITALITY); }
PLAYER(SPECIES_WOBBUFFET) { HP(health); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { }
} SCENE {
if (health == 75) {
ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY);
MESSAGE("The Wobbuffet drank down all the matcha that Sinistcha made!");
HP_BAR(playerRight, damage: -25);
} else {
NONE_OF {
ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY);
MESSAGE("The Wobbuffet drank down all the matcha that Sinistcha made!");
HP_BAR(playerRight, damage: -25);
}
}
}
}
DOUBLE_BATTLE_TEST("Hospitality user restores 25% of ally's health on switch-in")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET)
PLAYER(SPECIES_WOBBUFFET) { HP(75); MaxHP(100); }
PLAYER(SPECIES_POLTCHAGEIST) { Ability(ABILITY_HOSPITALITY); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(playerLeft, 2); }
} SCENE {
MESSAGE("Wobbuffet, that's enough! Come back!");
MESSAGE("Go! Ptchageist!");
ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY);
MESSAGE("The Wobbuffet drank down all the matcha that Sinistcha made!");
HP_BAR(playerRight, damage: -25);
}
}
DOUBLE_BATTLE_TEST("Hospitality ignores Substitute")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_POLTCHAGEIST) { Ability(ABILITY_HOSPITALITY); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerRight, MOVE_SUBSTITUTE); }
TURN { SWITCH(playerLeft, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, playerRight);
MESSAGE("Wobbuffet, that's enough! Come back!");
MESSAGE("Go! Ptchageist!");
ABILITY_POPUP(playerLeft, ABILITY_HOSPITALITY);
MESSAGE("The Wobbuffet drank down all the matcha that Sinistcha made!");
}
}