Add third type

This commit is contained in:
DizzyEggg 2018-11-17 12:10:24 +01:00
parent 65036b9a09
commit 15b8046b2b
16 changed files with 59 additions and 12 deletions

View File

@ -1570,6 +1570,11 @@
.macro setauroraveil battler .macro setauroraveil battler
various \battler, VARIOUS_SET_AURORA_VEIL various \battler, VARIOUS_SET_AURORA_VEIL
.endm .endm
.macro trysetthirdtype battler, ptr
various \battler, VARIOUS_TRY_THIRD_TYPE
.4byte \ptr
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat, stages, down .macro setstatchanger stat, stages, down

View File

@ -334,6 +334,19 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectDefenseUp2Hit .4byte BattleScript_EffectDefenseUp2Hit
.4byte BattleScript_EffectRevelationDance .4byte BattleScript_EffectRevelationDance
.4byte BattleScript_EffectAuroraVeil .4byte BattleScript_EffectAuroraVeil
.4byte BattleScript_EffectThirdType
BattleScript_EffectThirdType:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
trysetthirdtype BS_TARGET, BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_THIRDTYPEADDED
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectDefenseUp2Hit: BattleScript_EffectDefenseUp2Hit:
setmoveeffect MOVE_EFFECT_DEF_PLUS_2 | MOVE_EFFECT_AFFECTS_USER setmoveeffect MOVE_EFFECT_DEF_PLUS_2 | MOVE_EFFECT_AFFECTS_USER

View File

@ -603,11 +603,12 @@ struct BattleStruct
#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) #define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0)) #define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type)) #define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type || gBattleMons[battlerId].type3 == type))
#define SET_BATTLER_TYPE(battlerId, type) \ #define SET_BATTLER_TYPE(battlerId, type) \
{ \ { \
gBattleMons[battlerId].type1 = type; \ gBattleMons[battlerId].type1 = type; \
gBattleMons[battlerId].type2 = type; \ gBattleMons[battlerId].type2 = type; \
gBattleMons[battlerId].type3 = TYPE_MYSTERY; \
} }
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8

View File

@ -111,6 +111,7 @@ struct ChooseMoveStruct
u16 species; u16 species;
u8 monType1; u8 monType1;
u8 monType2; u8 monType2;
u8 monType3;
struct MegaEvolutionData mega; struct MegaEvolutionData mega;
}; };

View File

@ -322,5 +322,6 @@
#define EFFECT_DEFENSE_UP2_HIT 316 #define EFFECT_DEFENSE_UP2_HIT 316
#define EFFECT_REVELATION_DANCE 317 #define EFFECT_REVELATION_DANCE 317
#define EFFECT_AURORA_VEIL 318 #define EFFECT_AURORA_VEIL 318
#define EFFECT_THIRD_TYPE 319
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -131,6 +131,7 @@
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 69 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_FIRST_OFF 69
#define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 70 #define VARIOUS_TRY_TRAINER_SLIDE_MSG_LAST_ON 70
#define VARIOUS_SET_AURORA_VEIL 71 #define VARIOUS_SET_AURORA_VEIL 71
#define VARIOUS_TRY_THIRD_TYPE 72
// atk80, dmg manipulation // atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0 #define ATK80_DMG_CHANGE_SIGN 0

View File

@ -511,6 +511,7 @@
#define STRINGID_NOEFFECTONTARGET 507 #define STRINGID_NOEFFECTONTARGET 507
#define STRINGID_BURSTINGFLAMESHIT 508 #define STRINGID_BURSTINGFLAMESHIT 508
#define STRINGID_BESTOWITEMGIVING 509 #define STRINGID_BESTOWITEMGIVING 509
#define STRINGID_THIRDTYPEADDED 510
#define BATTLESTRINGS_COUNT 521 #define BATTLESTRINGS_COUNT 521

View File

@ -316,7 +316,7 @@ struct BattlePokemon
/*0x20*/ u8 ability; /*0x20*/ u8 ability;
/*0x21*/ u8 type1; /*0x21*/ u8 type1;
/*0x22*/ u8 type2; /*0x22*/ u8 type2;
/*0x23*/ u8 unknown; /*0x23*/ u8 type3;
/*0x24*/ u8 pp[4]; /*0x24*/ u8 pp[4];
/*0x28*/ u16 hp; /*0x28*/ u16 hp;
/*0x2A*/ u8 level; /*0x2A*/ u8 level;

View File

@ -506,7 +506,7 @@ static void HandleInputChooseMove(void)
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE) if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)
{ {
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST && moveInfo->monType3 != TYPE_GHOST)
moveTarget = MOVE_TARGET_USER; moveTarget = MOVE_TARGET_USER;
else else
moveTarget = MOVE_TARGET_SELECTED; moveTarget = MOVE_TARGET_SELECTED;

View File

@ -854,7 +854,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data)
itemsCount = 1; itemsCount = 1;
break; break;
case LIST_ITEM_TYPES: case LIST_ITEM_TYPES:
itemsCount = 2; itemsCount = 3;
break; break;
case LIST_ITEM_MOVES: case LIST_ITEM_MOVES:
case LIST_ITEM_PP: case LIST_ITEM_PP:
@ -972,7 +972,7 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data)
AddTextPrinter(&printer, 0, NULL); AddTextPrinter(&printer, 0, NULL);
break; break;
case LIST_ITEM_TYPES: case LIST_ITEM_TYPES:
for (i = 0; i < 2; i++) for (i = 0; i < 3; i++)
{ {
u8 *types = &gBattleMons[data->battlerId].type1; u8 *types = &gBattleMons[data->battlerId].type1;

View File

@ -221,7 +221,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
if (moveInfo->moves[chosenMoveId] == MOVE_CURSE) if (moveInfo->moves[chosenMoveId] == MOVE_CURSE)
{ {
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST) if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST && moveInfo->monType3 != TYPE_GHOST)
var1 = MOVE_TARGET_USER; var1 = MOVE_TARGET_USER;
else else
var1 = MOVE_TARGET_SELECTED; var1 = MOVE_TARGET_SELECTED;

View File

@ -3319,6 +3319,7 @@ void FaintClearSetData(void)
gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1;
gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2; gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2;
gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY;
ClearBattlerMoveHistory(gActiveBattler); ClearBattlerMoveHistory(gActiveBattler);
ClearBattlerAbilityHistory(gActiveBattler); ClearBattlerAbilityHistory(gActiveBattler);
@ -3389,6 +3390,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1; gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1;
gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2; gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2;
gBattleMons[gActiveBattler].type3 = TYPE_MYSTERY;
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility); gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp; *hpOnSwitchout = gBattleMons[gActiveBattler].hp;
@ -4256,6 +4258,7 @@ static void HandleTurnActionSelectionState(void)
moveInfo.species = gBattleMons[gActiveBattler].species; moveInfo.species = gBattleMons[gActiveBattler].species;
moveInfo.monType1 = gBattleMons[gActiveBattler].type1; moveInfo.monType1 = gBattleMons[gActiveBattler].type1;
moveInfo.monType2 = gBattleMons[gActiveBattler].type2; moveInfo.monType2 = gBattleMons[gActiveBattler].type2;
moveInfo.monType3 = gBattleMons[gActiveBattler].type3;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
@ -5426,6 +5429,8 @@ void SetTypeBeforeUsingMove(u16 move, u8 battlerAtk)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | 0x80; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type1 | 0x80;
else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY) else if (gBattleMons[battlerAtk].type2 != TYPE_MYSTERY)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | 0x80; gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type2 | 0x80;
else if (gBattleMons[battlerAtk].type3 != TYPE_MYSTERY)
gBattleStruct->dynamicMoveType = gBattleMons[battlerAtk].type3 | 0x80;
} }
attackerAbility = GetBattlerAbility(battlerAtk); attackerAbility = GetBattlerAbility(battlerAtk);

View File

@ -648,6 +648,7 @@ static const u8 sText_Infestation[] = _("{B_DEF_NAME_WITH_PREFIX} has been affli
static const u8 sText_NoEffectOnTarget[] = _("It had no effect\non {B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_NoEffectOnTarget[] = _("It had no effect\non {B_DEF_NAME_WITH_PREFIX}!");
static const u8 sText_BurstingFlames[] = _("The bursting flames\nhit {B_SCR_ACTIVE_NAME_WITH_PREFIX}!"); static const u8 sText_BurstingFlames[] = _("The bursting flames\nhit {B_SCR_ACTIVE_NAME_WITH_PREFIX}!");
static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received {B_LAST_ITEM}\nfrom {B_ATK_NAME_WITH_PREFIX}!"); static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received {B_LAST_ITEM}\nfrom {B_ATK_NAME_WITH_PREFIX}!");
static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_NAME_WITH_PREFIX}!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
@ -1150,6 +1151,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_NoEffectOnTarget, sText_NoEffectOnTarget,
sText_BurstingFlames, sText_BurstingFlames,
sText_BestowItemGiving, sText_BestowItemGiving,
sText_ThirdTypeAdded,
}; };
const u16 gTerrainStringIds[] = const u16 gTerrainStringIds[] =

View File

@ -7127,6 +7127,18 @@ static void atk76_various(void)
gBattleCommunication[MULTISTRING_CHOOSER] = 5; gBattleCommunication[MULTISTRING_CHOOSER] = 5;
} }
break; break;
case VARIOUS_TRY_THIRD_TYPE:
if (IS_BATTLER_OF_TYPE(gActiveBattler, gBattleMoves[gCurrentMove].argument))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
else
{
gBattleMons[gActiveBattler].type3 = gBattleMoves[gCurrentMove].argument;
PREPARE_TYPE_BUFFER(gBattleTextBuff1, gBattleMoves[gCurrentMove].argument);
gBattlescriptCurrInstr += 7;
}
return;
} }
gBattlescriptCurrInstr += 3; gBattlescriptCurrInstr += 3;

View File

@ -5483,6 +5483,9 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility); MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility);
if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1) if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility); MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility);
if (gBattleMons[battlerDef].type3 != TYPE_MYSTERY && gBattleMons[battlerDef].type3 != gBattleMons[battlerDef].type2
&& gBattleMons[battlerDef].type3 != gBattleMons[battlerDef].type1)
MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type3, atkAbility);
if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef)) if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef))
{ {

View File

@ -6817,7 +6817,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_PHYSICAL, .split = SPLIT_PHYSICAL,
}, },
{ // MOVE_TRICK_OR_TREAT { // MOVE_TRICK_OR_TREAT
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect .effect = EFFECT_THIRD_TYPE,
.power = 0, .power = 0,
.type = TYPE_GHOST, .type = TYPE_GHOST,
.accuracy = 100, .accuracy = 100,
@ -6827,6 +6827,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0, .priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
.argument = TYPE_GHOST,
}, },
{ // MOVE_NOBLE_ROAR { // MOVE_NOBLE_ROAR
.effect = EFFECT_NOBLE_ROAR, .effect = EFFECT_NOBLE_ROAR,
@ -6865,7 +6866,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.split = SPLIT_SPECIAL, .split = SPLIT_SPECIAL,
}, },
{ // MOVE_FOREST_S_CURSE { // MOVE_FOREST_S_CURSE
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect .effect = EFFECT_THIRD_TYPE,
.power = 0, .power = 0,
.type = TYPE_GRASS, .type = TYPE_GRASS,
.accuracy = 100, .accuracy = 100,
@ -6875,6 +6876,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.priority = 0, .priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED,
.split = SPLIT_STATUS, .split = SPLIT_STATUS,
.argument = TYPE_GRASS,
}, },
{ // MOVE_PETAL_BLIZZARD { // MOVE_PETAL_BLIZZARD
.effect = EFFECT_HIT, .effect = EFFECT_HIT,