Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
add all evo methods
Browse files Browse the repository at this point in the history
for obvious reasons, didn't do inkay or shelmet/karrablast
  • Loading branch information
BluRosie committed Sep 5, 2018
1 parent c030212 commit 6e3081d
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 6 deletions.
16 changes: 16 additions & 0 deletions constants/pokemon_data_constants.inc
Expand Up @@ -61,6 +61,8 @@

.set F_SUMMARY_SCREEN_FLIP_SPRITE, 0x80

@ see "/include/pokemon.h" for descriptions

.set EVO_FRIENDSHIP, 0x0001 @ Pokémon levels up with friendship ≥ 220
.set EVO_FRIENDSHIP_DAY, 0x0002 @ Pokémon levels up during the day with friendship ≥ 220
.set EVO_FRIENDSHIP_NIGHT, 0x0003 @ Pokémon levels up at night with friendship ≥ 220
Expand All @@ -76,3 +78,17 @@
.set EVO_LEVEL_NINJASK, 0x000d @ Pokémon reaches the specified level (special value for Ninjask)
.set EVO_LEVEL_SHEDINJA, 0x000e @ Pokémon reaches the specified level (special value for Shedinja)
.set EVO_BEAUTY, 0x000f @ Pokémon levels up with beauty ≥ specified value
.set EVO_LEVEL_MALE, 0x0010
.set EVO_LEVEL_FEMALE, 0x0011
.set EVO_ITEM_MALE, 0x0012
.set EVO_ITEM_FEMALE, 0x0013
.set EVO_MOVE, 0x0014
.set EVO_MAPNUM, 0x0015
.set EVO_LEVEL_DAY, 0x0016
.set EVO_LEVEL_NIGHT, 0x0017
.set EVO_ITEM_DAY, 0x0018
.set EVO_ITEM_NIGHT, 0x0019
.set EVO_LEVEL_MON, 0x001a
.set EVO_LEVEL_DARK, 0x001b
.set EVO_LEVEL_RAIN, 0x001c
@ .set EVO_TRADE_MON, 0x001d
3 changes: 3 additions & 0 deletions include/constants/maps.h
Expand Up @@ -471,4 +471,7 @@
#define MAP_GROUP(map) (MAP_##map >> 8)
#define MAP_NUM(map) (MAP_##map & 0xFF)

#define EVO_MAP_GROUP(map) (map >> 8)
#define EVO_MAP_NUM(map) (map & 0xFF)

#endif // GUARD_CONSTANTS_MAPS_H
16 changes: 15 additions & 1 deletion include/pokemon.h
Expand Up @@ -335,7 +335,7 @@ struct UnknownPokemonStruct

#define BATTLE_STATS_NO 8

struct BattlePokemon // okay let's see if this works, taking a bit out of maxHP and giving it to hidden abilities
struct BattlePokemon
{
/*0x00*/ u16 species;
/*0x02*/ u16 attack;
Expand Down Expand Up @@ -502,6 +502,20 @@ enum {
#define EVO_LEVEL_NINJASK 0x000d // Pokémon reaches the specified level (special value for Ninjask)
#define EVO_LEVEL_SHEDINJA 0x000e // Pokémon reaches the specified level (special value for Shedinja)
#define EVO_BEAUTY 0x000f // Pokémon levels up with beauty ≥ specified value
#define EVO_LEVEL_MALE 0x0010 // Pokémon reaches specified level while male
#define EVO_LEVEL_FEMALE 0x0011 // Pokémon reaches specified level while female
#define EVO_ITEM_MALE 0x0012 // specified item is used on male Pokémon
#define EVO_ITEM_FEMALE 0x0013 // specified item is used on female Pokémon
#define EVO_MOVE 0x0014 // Pokémon levels up with specified move
#define EVO_MAPNUM 0x0015 // Pokémon levels up in specified map number
#define EVO_LEVEL_DAY 0x0016 // Pokémon reaches specified level in the day
#define EVO_LEVEL_NIGHT 0x0017 // Pokémon reaches specified level in the night
#define EVO_ITEM_DAY 0x0018 // Pokémon levels up while holding specified item during the day
#define EVO_ITEM_NIGHT 0x0019 // Pokémon levels up while holding specified item during the night
#define EVO_LEVEL_MON 0x001a // Pokémon levels up while specified mon is in the party
#define EVO_LEVEL_DARK 0x001b // Pokémon reaches specified level while a Dark-type Pokémon is in the party
#define EVO_LEVEL_RAIN 0x001c // Pokémon reaches specified level while raining in the overworld
//#define EVO_TRADE_MON 0X001d // Pokémon is traded with specified Pokémon

struct Evolution
{
Expand Down
6 changes: 3 additions & 3 deletions src/battle/calculate_base_damage.c
Expand Up @@ -267,8 +267,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage = 1;
}

if (type == TYPE_MYSTERY)
damage = 0; // is ??? type. does 0 damage.
// if (type == TYPE_MYSTERY)
// damage = 0; // is ??? type. does 0 damage.

if (gBattleMoves[gCurrentMove].split == MOVE_SPECIAL)
{
Expand All @@ -292,7 +292,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
else */if (defender->statStages[STAT_STAGE_SPDEF] < 6)
APPLY_STAT_MOD(damageHelper, defender, spDefense, STAT_STAGE_SPDEF)
else
/*if (if (gBattleMoves[gCurrentMove].effect == EFFECT_PSYCHO_CUT)
/*if (gBattleMoves[gCurrentMove].effect == EFFECT_PSYCHO_CUT)
damageHelper = defense;
else*/
damageHelper = spDefense;
Expand Down
2 changes: 2 additions & 0 deletions src/data/pokemon/evolution.h
@@ -1,6 +1,8 @@
#ifndef POKERUBY_EVOLUTION_H
#define POKERUBY_EVOLUTION_H

#include "constants/maps.h"

struct Evolution gEvolutionTable[NUM_SPECIES][5] =
{
[SPECIES_BULBASAUR] = {{EVO_LEVEL, 16, SPECIES_IVYSAUR}},
Expand Down
74 changes: 72 additions & 2 deletions src/pokemon_3.c
@@ -1,11 +1,14 @@
#include "global.h"
#include "constants/hold_effects.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/moves.h"
#include "constants/weather.h"
#include "battle.h"
#include "battle_message.h"
#include "data2.h"
#include "event_data.h"
#include "field_weather.h"
#include "item.h"
#include "link.h"
#include "m4a.h"
Expand All @@ -15,6 +18,7 @@
#include "pokedex.h"
#include "random.h"
#include "overworld.h"
#include "party_menu.h"
#include "rom_8077ABC.h"
#include "rom_8094928.h"
#include "rtc.h"
Expand Down Expand Up @@ -266,6 +270,7 @@ u8 GetNatureFromPersonality(u32 personality)
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
{
int i;
int j;
u16 targetSpecies = 0;
u16 species = GetMonData(mon, MON_DATA_SPECIES, 0);
u16 heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
Expand All @@ -275,6 +280,9 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
u8 beauty = GetMonData(mon, MON_DATA_BEAUTY, 0);
u16 upperPersonality = personality >> 16;
u8 holdEffect;
u8 gender = GetMonGender(mon);
u8 mapGroup = gSaveBlock1.location.mapGroup;
u8 mapNum = gSaveBlock1.location.mapNum;

if (heldItem == ITEM_ENIGMA_BERRY)
holdEffect = gSaveBlock1.enigmaBerry.holdEffect;
Expand Down Expand Up @@ -343,6 +351,66 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
if (gEvolutionTable[species][i].param <= beauty)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_MALE:
if (gEvolutionTable[species][i].param <= level && gender == MON_MALE)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_FEMALE:
if (gEvolutionTable[species][i].param <= level && gender == MON_FEMALE)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_MOVE:
if (pokemon_has_move(&gPlayerParty[i], gEvolutionTable[species][i].param) == TRUE)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_MAPNUM:
if (EVO_MAP_GROUP(gEvolutionTable[species][i].param) == mapGroup && EVO_MAP_NUM(gEvolutionTable[species][i].param) == mapNum)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_DAY:
RtcCalcLocalTime();
if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && gEvolutionTable[species][i].param <= level)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_NIGHT:
RtcCalcLocalTime();
if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && gEvolutionTable[species][i].param <= level)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_ITEM_DAY:
RtcCalcLocalTime();
if (gLocalTime.hours >= 12 && gLocalTime.hours < 24 && gEvolutionTable[species][i].param == heldItem)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_ITEM_NIGHT:
RtcCalcLocalTime();
if (gLocalTime.hours >= 0 && gLocalTime.hours < 12 && gEvolutionTable[species][i].param == heldItem)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
case EVO_LEVEL_MON:
for (j = 0; j < PARTY_SIZE; j++)
{
u16 checkSpecies = GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL);
if (checkSpecies == gEvolutionTable[species][i].param)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;
case EVO_LEVEL_DARK:
for (j = 0; j < PARTY_SIZE; j++)
{
u16 checkType1 = gBaseStats[GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL)].type1;
u16 checkType2 = gBaseStats[GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL)].type2;
if ((checkType1 == TYPE_DARK || checkType2 == TYPE_DARK) && gEvolutionTable[species][i].param <= level && i != j) // i != j because pancham can't evolve itself
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;
case EVO_LEVEL_RAIN:
if ((GetCurrentWeather() == WEATHER_RAIN_LIGHT
|| GetCurrentWeather() == WEATHER_RAIN_MED
|| GetCurrentWeather() == WEATHER_RAIN_HEAVY)
&& gEvolutionTable[species][i].param <= level)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
}
}
break;
Expand All @@ -367,10 +435,12 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
break;
case 2:
case 3:
RtcCalcLocalTime();
for (i = 0; i < 5; i++)
{
if (gEvolutionTable[species][i].method == EVO_ITEM
&& gEvolutionTable[species][i].param == evolutionItem)
if ((gEvolutionTable[species][i].method == EVO_ITEM && gEvolutionTable[species][i].param == evolutionItem)
|| (gEvolutionTable[species][i].method == EVO_ITEM_MALE && gEvolutionTable[species][i].param == evolutionItem && gender == MON_MALE)
|| (gEvolutionTable[species][i].method == EVO_ITEM_FEMALE && gEvolutionTable[species][i].param == evolutionItem && gender == MON_FEMALE))
{
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
Expand Down

0 comments on commit 6e3081d

Please sign in to comment.