Skip to content
Permalink
Browse files

3 New Abilities 1 Act

Storm Drain
Motor Drive
Sap Sipper
Lightning Rod
  • Loading branch information...
Lumbreon committed May 1, 2019
1 parent 1d040b4 commit 6ef4d7e191c9b267c9d24714eafba10122bbdd70
@@ -350,3 +350,7 @@
enum BATTLE_TEXT_Obtained3
enum BATTLE_TEXT_NoEffect
enum BATTLE_TEXT_NoEffectOn
enum BATTLE_TEXT_BadDreamsDmg
enum BATTLE_TEXT_SpeedRaisedUsing
enum BATTLE_TEXT_AttackRaisedUsing
enum BATTLE_TEXT_SpAttackRaisedUsing
@@ -50,7 +50,11 @@ AI_CheckBadMove: @ 81DA09C
if_damage_bonus 0, Score_Minus10
get_ability TARGET
if_equal ABILITY_VOLT_ABSORB, CheckIfVoltAbsorbCancelsElectric
if_equal ABILITY_LIGHTNING_ROD, CheckIfVoltAbsorbCancelsElectric
if_equal ABILITY_MOTOR_DRIVE, CheckIfVoltAbsorbCancelsElectric
if_equal ABILITY_WATER_ABSORB, CheckIfWaterAbsorbCancelsWater
if_equal ABILITY_STORM_DRAIN, CheckIfWaterAbsorbCancelsWater
if_equal ABILITY_SAP_SIPPER, CheckIfSapSipperCancelsGrass
if_equal ABILITY_FLASH_FIRE, CheckIfFlashFireCancelsFire
if_equal ABILITY_WONDER_GUARD, CheckIfWonderGuardCancelsMove
if_equal ABILITY_LEVITATE, CheckIfLevitateCancelsGroundMove
@@ -60,6 +64,11 @@ CheckIfVoltAbsorbCancelsElectric: @ 81DA0CE
get_type CURRENT_MOVE
if_arg_equal TYPE_ELECTRIC, Score_Minus12
jump AI_CheckBadMove_CheckSoundproof

CheckIfSapSipperCancelsGrass: @ 81DA0CE
get_type CURRENT_MOVE
if_arg_equal TYPE_GRASS, Score_Minus12
jump AI_CheckBadMove_CheckSoundproof

CheckIfWaterAbsorbCancelsWater: @ 81DA0DB
get_type CURRENT_MOVE
@@ -4164,6 +4164,18 @@ BattleScript_MoveHPDrain_FullHP:: @ 81D9866
orbyte gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
goto BattleScript_MoveEnd

BattleScript_MoveStatDrain_PPLoss::
ppreduce
BattleScript_MoveStatDrain::
attackstring
pause 0x20
setgraphicalstatchangevalues
playanimation TARGET, B_ANIM_STATS_CHANGE, sANIM_ARG1
waitanimation
printfromtable gStatDrainStrings
waitmessage 0x40
goto BattleScript_MoveEnd

BattleScript_FlashFireBoost_PPLoss:: @ 81D987B
ppreduce

@@ -235,6 +235,15 @@ gAbilityDescription_AirLock: @ 81FA0F6
gAbilityDescription_BadDreams: @ 81FA0F6
.string "Hurt sleeping foes.$"

gAbilityDescription_StormDrain: @ 81FA0F6
.string "Canges water into SP.ATK.$"

gAbilityDescription_MotorDrive: @ 81FA0F6
.string "Turns electricity to SP.ATK.$"

gAbilityDescription_SapSipper: @ 81FA0F6
.string "Eat GRASS to raise ATK.$"

.align 2
gAbilityDescriptions:: @ 81FA110
.4byte gAbilityDescription_None
@@ -316,3 +325,6 @@ gAbilityDescriptions:: @ 81FA110
.4byte gAbilityDescription_Cacophony
.4byte gAbilityDescription_AirLock
.4byte gAbilityDescription_BadDreams
.4byte gAbilityDescription_StormDrain
.4byte gAbilityDescription_MotorDrive
.4byte gAbilityDescription_SapSipper
@@ -78,3 +78,7 @@ gAbilityNames:: @ 81FA248
.string "CACOPHONY$", 13
.string "AIR LOCK$", 13
.string "BAD DREAMS$", 13
.string "STORM DRAIN$", 13
.string "MOTOR DRIVE$", 13
.string "SAP SIPPER$", 13
@@ -530,6 +530,7 @@ struct SpecialStatus
u8 moveturnSpecialBank;
u8 field12;
u8 field13;
u8 stormDrainRedirected : 1;
};

struct sideTimer
@@ -649,7 +650,7 @@ extern struct Struct20238C8 gUnknown_020238C8;

#define SET_STAT_BUFF_VALUE(n)(((s8)(((s8)(n) << 4)) & 0xF0))

#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleStruct->statChanger = (statId) + (stage << 4) + (goesDown << 7))

// used in many battle files, it seems as though Hisashi Sogabe wrote
// some sort of macro to replace the use of actually calling memset.
@@ -80,5 +80,8 @@
#define ABILITY_CACOPHONY 76
#define ABILITY_AIR_LOCK 77
#define ABILITY_BAD_DREAMS 78
#define ABILITY_STORM_DRAIN 79
#define ABILITY_MOTOR_DRIVE 80
#define ABILITY_SAP_SIPPER 81

#endif // GUARD_CONSTANTS_ABILITIES_H
@@ -5195,6 +5195,70 @@ void HandleAction_UseMove(void)
gSpecialStatuses[gActiveBattler].lightningRodRedirected = 1;
gBankTarget = gActiveBattler;
}
}
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& gSideTimers[side].followmeTimer == 0
&& (gBattleMoves[gCurrentMove].power != 0
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_x10)
&& gBattleMons[ewram16010arr(gBankAttacker)].ability != ABILITY_STORM_DRAIN
&& gBattleMoves[gCurrentMove].type == TYPE_WATER)
{
side = GetBattlerSide(gBankAttacker);
for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++)
{
if (side != GetBattlerSide(gActiveBattler)
&& ewram16010arr(gBankAttacker) != gActiveBattler
&& gBattleMons[gActiveBattler].ability == ABILITY_STORM_DRAIN
&& BankGetTurnOrder(gActiveBattler) < var)
{
var = BankGetTurnOrder(gActiveBattler);
}
}
if (var == 4)
{
if (gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
{
if (GetBattlerSide(gBankAttacker) == B_SIDE_PLAYER)
{
if (Random() & 1)
gBankTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
else
gBankTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
else
{
if (Random() & 1)
gBankTarget = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
else
gBankTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
}
}
else
{
gBankTarget = ewram16010arr(gBankAttacker);
}

if (gAbsentBattlerFlags & gBitTable[gBankTarget])
{
if (GetBattlerSide(gBankAttacker) != GetBattlerSide(gBankTarget))
{
gBankTarget = GetBattlerAtPosition(GetBattlerPosition(gBankTarget) ^ BIT_FLANK);
}
else
{
gBankTarget = GetBattlerAtPosition(GetBattlerPosition(gBankAttacker) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[gBankTarget])
gBankTarget = GetBattlerAtPosition(GetBattlerPosition(gBankTarget) ^ BIT_FLANK);
}
}
}
else
{
gActiveBattler = gBanksByTurnOrder[var];
RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability);
gSpecialStatuses[gActiveBattler].stormDrainRedirected = 1;
gBankTarget = gActiveBattler;
}
}
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& gBattleMoves[gChosenMove].target & MOVE_TARGET_RANDOM)
@@ -1172,6 +1172,14 @@ static void atk00_attackcanceler(void)
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TookAttack;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
}
else if (gSpecialStatuses[gBankTarget].stormDrainRedirected)
{
gSpecialStatuses[gBankTarget].stormDrainRedirected = 0;
gLastUsedAbility = ABILITY_STORM_DRAIN;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TookAttack;
RecordAbilityBattle(gBankTarget, gLastUsedAbility);
}
else if (TARGET_PROTECT_AFFECTED
&& (gCurrentMove != MOVE_CURSE || (gBattleMons[gBankAttacker].type1 == TYPE_GHOST || gBattleMons[gBankAttacker].type2 == TYPE_GHOST))
@@ -6405,12 +6413,15 @@ static void atk47_setgraphicalstatchangevalues(void)
#ifdef NONMATCHING
static void atk48_playstatchangeanimation(void)
{
u32 ability;
int curr_stat = 0;
u16 stat_animID = 0;
int changeable_stats = 0;
u32 stats_to_check;
u8 arg3;
u32 flags = gBattlescriptCurrInstr[3];

ability = gBattleMons[gActiveBattler].ability;
gActiveBattler = GetBattleBank(T2_READ_8(gBattlescriptCurrInstr + 1));
stats_to_check = T2_READ_8(gBattlescriptCurrInstr + 2);
arg3 = T2_READ_8(gBattlescriptCurrInstr + 3);
@@ -11523,8 +11534,8 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED)
notProtectAffected++;
flags &= ~(STAT_CHANGE_NOT_PROTECT_AFFECTED);

PREPARE_STAT_BUFFER(gBattleTextBuff1, statId)


if ((statValue << 0x18) < 0) // stat decrease
{
@@ -15696,6 +15707,17 @@ void atkEF_handleballthrow(void)
}
}
}
bool32 IsBattlerAlive(u8 battlerId)
{
if (gBattleMons[battlerId].hp == 0)
return FALSE;
else if (battlerId >= gBattlersCount)
return FALSE;
else if (gAbsentBattlerFlags & gBitTable[battlerId])
return FALSE;
else
return TRUE;
}

static void atkF0_givecaughtmon(void)
{
@@ -15962,14 +15984,3 @@ static void atkF8_trygetbaddreamstarget(void)
else
gBattlescriptCurrInstr += 5;
}
bool32 IsBattlerAlive(u8 battlerId)
{
if (gBattleMons[battlerId].hp == 0)
return FALSE;
else if (battlerId >= gBattlersCount)
return FALSE;
else if (gAbsentBattlerFlags & gBitTable[battlerId])
return FALSE;
else
return TRUE;
}
@@ -16,7 +16,7 @@
#include "ewram.h"

#define BATTLESTRING_TO_SUB 12
#define BATTLESTRINGS_NO 351
#define BATTLESTRINGS_NO 355
#define BATTLESTRINGS_MAX BATTLESTRINGS_NO + BATTLESTRING_TO_SUB

#ifdef GERMAN
@@ -1,6 +1,7 @@
#include "global.h"
#include "battle.h"
#include "battle_util.h"
#include "battle_message.h"
#include "data2.h"
#include "event_data.h"
#include "ewram.h"
@@ -163,6 +164,8 @@ extern u8 BattleScript_FlashFireBoost[];
extern u8 BattleScript_FlashFireBoost_PPLoss[];
extern u8 BattleScript_MoveHPDrain_FullHP[];
extern u8 BattleScript_MoveHPDrain_FullHP_PPLoss[];
extern u8 BattleScript_MoveStatDrain_PPLoss[];
extern u8 BattleScript_MoveStatDrain[];
extern u8 BattleScript_ColorChangeActivates[];
extern u8 BattleScript_RoughSkinActivates[];
extern u8 BattleScript_ApplySecondaryEffect[];
@@ -1695,6 +1698,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
u16 speciesDef;
u32 pidAtk;
u32 pidDef;
u8 StatId;

if (gBankAttacker >= gBattlersCount)
gBankAttacker = bank;
@@ -1952,6 +1956,26 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
effect = 1;
}
break;
case ABILITY_MOTOR_DRIVE:
if (moveType == TYPE_ELECTRIC)
effect = 3, StatId = STAT_STAGE_SPEED;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
break;
case ABILITY_LIGHTNING_ROD:
if (moveType == TYPE_ELECTRIC)
effect = 3, StatId = STAT_STAGE_SPATK;
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
break;
case ABILITY_STORM_DRAIN:
if (moveType == TYPE_WATER)
effect = 3, StatId = STAT_STAGE_SPATK;
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
break;
case ABILITY_SAP_SIPPER:
if (moveType == TYPE_GRASS)
effect = 3, StatId = STAT_STAGE_ATK;
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
break;
case ABILITY_WATER_ABSORB:
if (moveType == TYPE_WATER && gBattleMoves[move].power != 0)
{
@@ -2004,6 +2028,26 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleMoveDamage *= -1;
}
}
else if (effect == 3)
{
if (gBattleMons[bank].statStages[StatId] == 0xC)
{
if ((gProtectStructs[gBankAttacker].notFirstStrike))
gBattlescriptCurrInstr = BattleScript_MoveHPDrain_FullHP;
else
gBattlescriptCurrInstr = BattleScript_MoveHPDrain_FullHP_PPLoss;
}
else
{
if (gProtectStructs[gBankAttacker].notFirstStrike)
gBattlescriptCurrInstr = BattleScript_MoveStatDrain;
else
gBattlescriptCurrInstr = BattleScript_MoveStatDrain_PPLoss;

SET_STATCHANGER(StatId, 1, FALSE);
gBattleMons[bank].statStages[StatId]++;
}
}
}
break;
case ABILITYEFFECT_CONTACT: // 4
@@ -3401,6 +3445,14 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget) //get move target
targetBank ^= 2;
RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability);
gSpecialStatuses[targetBank].lightningRodRedirected = 1;
}
else if (gBattleMoves[move].type == TYPE_WATER
&& AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIZE, gBankAttacker, ABILITY_STORM_DRAIN, 0, 0)
&& gBattleMons[targetBank].ability != ABILITY_STORM_DRAIN)
{
targetBank ^= 2;
RecordAbilityBattle(targetBank, gBattleMons[targetBank].ability);
gSpecialStatuses[targetBank].stormDrainRedirected = 1;
}
}
break;

0 comments on commit 6ef4d7e

Please sign in to comment.
You can’t perform that action at this time.