Fix crits and do Worry Seed

This commit is contained in:
DizzyEggg 2018-07-23 22:18:56 +02:00
parent 6570324432
commit 567a0240f3
7 changed files with 48 additions and 10 deletions

View File

@ -1243,6 +1243,11 @@
.4byte \ptr
.endm
.macro tryworryseed ptr
.byte 0xfe
.4byte \ptr
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves bank
various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES

View File

@ -177,7 +177,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectStockpile
.4byte BattleScript_EffectSpitUp
.4byte BattleScript_EffectSwallow
.4byte BattleScript_EffectUnusedA3
.4byte BattleScript_EffectWorrySeed
.4byte BattleScript_EffectHail
.4byte BattleScript_EffectTorment
.4byte BattleScript_EffectFlatter
@ -271,6 +271,18 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectPowerSplit
.4byte BattleScript_EffectGuardSplit
BattleScript_EffectWorrySeed:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
tryworryseed BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_PKMNACQUIREDABILITY
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectPowerSplit:
attackcanceler
attackstring
@ -357,10 +369,10 @@ BattleScript_EffectStealthRock:
attackcanceler
attackstring
ppreduce
setstealthrock STRINGID_POINTEDSTONESFLOAT
setstealthrock BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_POISONSPIKESSCATTERED
printstring STRINGID_POINTEDSTONESFLOAT
waitmessage 0x40
goto BattleScript_MoveEnd
@ -492,7 +504,6 @@ BattleScript_EffectAlwaysCrit:
BattleScript_EffectUnused6e:
BattleScript_EffectPursuit:
BattleScript_EffectUnused8d:
BattleScript_EffectUnusedA3:
BattleScript_EffectPlaceholder200:
BattleScript_EffectPlaceholder209:
BattleScript_EffectHit::

View File

@ -164,7 +164,7 @@
#define EFFECT_STOCKPILE 160
#define EFFECT_SPIT_UP 161
#define EFFECT_SWALLOW 162
#define EFFECT_UNUSED_A3 163
#define EFFECT_WORRY_SEED 163
#define EFFECT_HAIL 164
#define EFFECT_TORMENT 165
#define EFFECT_FLATTER 166

View File

@ -4660,7 +4660,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_WORRY_SEED
.effect = EFFECT_PLACEHOLDER_209,
.effect = EFFECT_WORRY_SEED,
.power = 0,
.type = TYPE_GRASS,
.accuracy = 100,
@ -5764,7 +5764,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_STORM_THROW
.effect = EFFECT_PLACEHOLDER_209,
.effect = EFFECT_ALWAYS_CRIT,
.power = 60,
.type = TYPE_FIGHTING,
.accuracy = 100,
@ -6292,7 +6292,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_FROST_BREATH
.effect = EFFECT_PLACEHOLDER_209,
.effect = EFFECT_ALWAYS_CRIT,
.power = 60,
.type = TYPE_ICE,
.accuracy = 90,

View File

@ -752,6 +752,7 @@ static bool32 AI_GetIfCrit(u32 move, u8 battlerAtk, u8 battlerDef)
else
isCrit = FALSE;
break;
case -2:
case 3:
case 4:
isCrit = TRUE;

View File

@ -543,7 +543,7 @@ static const u8 sText_PkmnsAbilitySuppressed[] = _("{B_DEF_NAME_WITH_PREFIX}s
static const u8 sText_ShieldedFromCriticalHits[] = _("The {B_CURRENT_MOVE} shielded your\nteam from critical hits!");
static const u8 sText_SwitchedAtkAndSpAtk[] = _("{B_ATK_NAME_WITH_PREFIX} switched all its\nchanges to its Attack and\pSp. Atk with the target!");
static const u8 sText_SwitchedDefAndSpDef[] = _("{B_ATK_NAME_WITH_PREFIX} switched all its\nchanges to its Defense and\pSp. Def with the target!");
static const u8 sText_PkmnAcquiredAbility[] = _("{B_DEF_NAME_WITH_PREFIX} acquired\n{B_LAST_ABILITY}!");
static const u8 sText_PkmnAcquiredAbility[] = _("{B_DEF_NAME_WITH_PREFIX} acquired\n{B_DEF_ABILITY}!");
static const u8 sText_PoisonSpikesScattered[] = _("Poison Spikes were scattered\nall around the foes teams\pfeet!");
static const u8 sText_PkmnSwitchedStatChanges[] = _("{B_ATK_NAME_WITH_PREFIX} switched stat changes\nwith the target!");
static const u8 sText_PkmnSurroundedWithVeilOfWater[] = _("{B_ATK_NAME_WITH_PREFIX} surrounded itself\nwith a veil of water!");

View File

@ -345,6 +345,7 @@ static void atkFA_swapstatstages(void);
static void atkFB_averagestats(void);
static void atkFC_jumpifoppositegenders(void);
static void atkFD_trygetbaddreamstarget(void);
static void atkFE_tryworryseed(void);
void (* const gBattleScriptingCommandsTable[])(void) =
{
@ -602,6 +603,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atkFB_averagestats,
atkFC_jumpifoppositegenders,
atkFD_trygetbaddreamstarget,
atkFE_tryworryseed,
};
struct StatFractions
@ -1316,7 +1318,7 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi
|| gBattleMoves[move].effect == EFFECT_ALWAYS_CRIT
|| (abilityAtk == ABILITY_MERCILESS && gBattleMons[battlerDef].status1 & STATUS1_PSN_ANY))
{
critChance = 4;
critChance = -2;
}
else
{
@ -1350,6 +1352,8 @@ static void atk04_critcalc(void)
gIsCriticalHit = FALSE;
else if (critChance == -1)
gIsCriticalHit = FALSE;
else if (critChance == -2)
gIsCriticalHit = TRUE;
else if (Random() % sCriticalHitChanceGen3[critChance] == 0)
gIsCriticalHit = TRUE;
else
@ -10400,3 +10404,20 @@ static void atkFD_trygetbaddreamstarget(void)
else
gBattlescriptCurrInstr += 5;
}
static void atkFE_tryworryseed(void)
{
switch (gBattleMons[gBattlerTarget].ability)
{
case ABILITY_INSOMNIA:
case ABILITY_MULTITYPE:
case ABILITY_TRUANT:
case ABILITY_STANCE_CHANGE:
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
break;
default:
gBattleMons[gBattlerTarget].ability = ABILITY_INSOMNIA;
gBattlescriptCurrInstr += 5;
break;
}
}