Skip to content

Commit

Permalink
Fix changing abilities in gen 3
Browse files Browse the repository at this point in the history
(Fixes #52)
  • Loading branch information
Epicpkmn11 committed Mar 25, 2020
1 parent 3feda75 commit 2e70792
Showing 1 changed file with 45 additions and 39 deletions.
84 changes: 45 additions & 39 deletions arm9/source/menus/summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,54 @@ int summaryPage = 0;
std::vector<std::string> summaryLabels = {"species", "level", "ability", "nature", "item", "shiny", "pokerus", "origTrainer", "trainerID", "secretID", "friendship"};

void changeAbility(PKX &pkm) {
if(pkm.generation() == Generation::FOUR) {
u8 setAbility = pkm.ability();
if(pkm.abilities(0) != setAbility && pkm.abilities(0) != 0) {
pkm.setAbility(0);
} else if(pkm.abilities(1) != 0) {
pkm.setAbility(1);
} else { // Just in case
pkm.setAbility(0);
switch(pkm.generation()) {
case Generation::THREE:
case Generation::FOUR: {
u8 setAbility = pkm.ability();
if(pkm.abilities(0) != setAbility && pkm.abilities(0) != 0) {
pkm.setAbility(0);
} else if(pkm.abilities(1) != 0) {
pkm.setAbility(1);
} else { // Just in case
pkm.setAbility(0);
}
break;
}
} else if(pkm.generation() == Generation::FIVE) {
PK5* pk5 = (PK5*)&pkm;
switch(pkm.abilityNumber() >> 1) {
case 0:
if(pkm.abilities(1) != pkm.ability() && pkm.abilities(1) != 0) {
pkm.setAbility(1);
if(pk5->abilities(1) == pk5->abilities(2)) {
pk5->hiddenAbility(true);
case Generation::FIVE: {
PK5* pk5 = (PK5*)&pkm;
switch(pkm.abilityNumber() >> 1) {
case 0:
if(pkm.abilities(1) != pkm.ability() && pkm.abilities(1) != 0) {
pkm.setAbility(1);
if(pk5->abilities(1) == pk5->abilities(2)) {
pk5->hiddenAbility(true);
}
} else if(pkm.abilities(2) != 0) {
pkm.setAbility(2);
}
} else if(pkm.abilities(2) != 0) {
pkm.setAbility(2);
}
break;
case 1:
if(pkm.abilities(2) != pkm.ability() && pkm.abilities(2) != 0) {
pkm.setAbility(2);
}
else if(pkm.abilities(0) != 0)
{
pkm.setAbility(0);
}
break;
case 2:
if(pkm.abilities(0) != pkm.ability() && pkm.abilities(0) != 0)
{
pkm.setAbility(0);
} else if(pkm.abilities(1) != 0) {
pkm.setAbility(1);
if(pkm.abilities(1) == pkm.abilities(2)) {
pk5->hiddenAbility(true);
break;
case 1:
if(pkm.abilities(2) != pkm.ability() && pkm.abilities(2) != 0) {
pkm.setAbility(2);
}
}
break;
else if(pkm.abilities(0) != 0)
{
pkm.setAbility(0);
}
break;
case 2:
if(pkm.abilities(0) != pkm.ability() && pkm.abilities(0) != 0)
{
pkm.setAbility(0);
} else if(pkm.abilities(1) != 0) {
pkm.setAbility(1);
if(pkm.abilities(1) == pkm.abilities(2)) {
pk5->hiddenAbility(true);
}
}
break;
}
break;
}
}
}
Expand Down

0 comments on commit 2e70792

Please sign in to comment.