From cf0e38b11ff7d1da5fb1328037b6387c4bafbc01 Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Sun, 24 Mar 2019 22:33:54 -0400 Subject: [PATCH 1/8] Can't Knock Griseous Orb Off Giratina I'll do Plates Drives and Memories later --- src/battle_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 901edb152..75845bf50 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5916,6 +5916,8 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId) return FALSE; else if (ItemId_GetHoldEffect(itemId) == HOLD_EFFECT_MEGA_STONE && GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) return FALSE; + else if (species == SPECIES_GIRATINA && itemId == ITEM_GRISEOUS_ORB) + return FALSE; else return TRUE; } From fc69631a10a53b889e78211031236bfca9d3d21b Mon Sep 17 00:00:00 2001 From: Fontbane Date: Mon, 25 Mar 2019 17:49:29 -0400 Subject: [PATCH 2/8] Field effects for Gen IV Abilities Also added Honey (acts like White Flute for now) and made it so the Griseous Orb can't be removed from Giratina in battle. --- data/battle_ai_scripts.s | 2 +- graphics/items/icon_palettes/honey.pal | 19 +++ graphics/items/icons/honey.png | Bin 0 -> 5898 bytes include/constants/items.h | 169 +++++++++++++------------ include/item_use.h | 1 + src/battle_script_commands.c | 14 +- src/data/graphics/items.h | 3 + src/data/item_icon_table.h | 1 + src/data/items.h | 17 +++ src/data/text/item_descriptions.h | 1 + src/item_use.c | 10 ++ src/wild_encounter.c | 6 + 12 files changed, 155 insertions(+), 88 deletions(-) create mode 100644 graphics/items/icon_palettes/honey.pal create mode 100644 graphics/items/icons/honey.png diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 6ba2c8748..101889405 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3628,7 +3628,7 @@ AI_HPAware_DiscouragedEffectsWhenTargetLowHP: @ 82DE2B1 .byte EFFECT_LIGHT_SCREEN .byte EFFECT_OHKO .byte EFFECT_SUPER_FANG - .byte EFFECT_SUPER_FANG + .byte EFFECT_SUPER_FANG //Why is this here twice? .byte EFFECT_MIST .byte EFFECT_FOCUS_ENERGY .byte EFFECT_CONFUSE diff --git a/graphics/items/icon_palettes/honey.pal b/graphics/items/icon_palettes/honey.pal new file mode 100644 index 000000000..c5219f932 --- /dev/null +++ b/graphics/items/icon_palettes/honey.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +48 48 48 +120 80 32 +200 112 0 +80 152 152 +232 144 0 +96 184 192 +248 184 72 +248 240 184 +216 248 248 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icons/honey.png b/graphics/items/icons/honey.png new file mode 100644 index 0000000000000000000000000000000000000000..837243e77fe7fc015bca5c4b07668c5c8f3fa2ed GIT binary patch literal 5898 zcmV+l7xn0gP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+SQs_mgBf~MgK7h4}s``;h@)b+?;#V685z$zg&CY8WTdgD7+Xg#rv)iuoKJ4HU zgIg~1?%Z(xY%4yy>c&Y*(93R@NzXLCkcmOoJe%G7wb*msdd@c}+IdaOp3X9uviR*~ ze%kmqulIrWR_R)MmG@Y2T~0O4Whis{%U&eJ?kA@4#P__+OWj;AiS=YKo-h|C*sgvL z(WCvSEr0Ut*)LwfTz6~OJf8sw5$BFvjP+#TO4di4?3JC%))L1;ei~Qqd~lr%*cjck zW|JH56Uiw~=jNDf&%Q3Ydo$2NBGe+8)X+dAD}+e>baL*dmEI`2qTU(@+hN@Hr@1-_Md5HGs~>AExRbC6;@nn*BWWx%vKEBW&QLnhUE|eB(85GqTE%ppS zHjhG~zM88oChuB}>Zw_oO^BAtx25Qvf~RE5nAGq^pQXlSg*i8`d`bN*ELQt=6Y;k^!lc`Np0cZOCmao054irCRN4DUIQz zBT~F(M^b!L(m3@qp0u0yyx&<@&fSb-wmL%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Jln*aa+07*qoM6N<$g0YoOm;e9( literal 0 HcmV?d00001 diff --git a/include/constants/items.h b/include/constants/items.h index 176750a16..f0a6bedd1 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -509,98 +509,99 @@ #define ITEM_DRACO_PLATE 420 #define ITEM_DREAD_PLATE 421 #define ITEM_IRON_PLATE 422 +#define ITEM_HONEY 423 // Gen 5 Items -#define ITEM_EVIOLITE 423 -#define ITEM_FLOAT_STONE 424 -#define ITEM_BINDING_BAND 425 -#define ITEM_DOUSE_DRIVE 426 -#define ITEM_SHOCK_DRIVE 427 -#define ITEM_BURN_DRIVE 428 -#define ITEM_CHILL_DRIVE 429 -#define ITEM_FIRE_GEM 430 -#define ITEM_WATER_GEM 431 -#define ITEM_ELECTRIC_GEM 432 -#define ITEM_GRASS_GEM 433 -#define ITEM_ICE_GEM 434 -#define ITEM_FIGHTING_GEM 435 -#define ITEM_POISON_GEM 436 -#define ITEM_GROUND_GEM 437 -#define ITEM_FLYING_GEM 438 -#define ITEM_PSYCHIC_GEM 439 -#define ITEM_BUG_GEM 440 -#define ITEM_ROCK_GEM 441 -#define ITEM_GHOST_GEM 442 -#define ITEM_DRAGON_GEM 443 -#define ITEM_DARK_GEM 444 -#define ITEM_STEEL_GEM 445 -#define ITEM_NORMAL_GEM 446 -#define ITEM_FAIRY_GEM 447 +#define ITEM_EVIOLITE 424 +#define ITEM_FLOAT_STONE 425 +#define ITEM_BINDING_BAND 426 +#define ITEM_DOUSE_DRIVE 427 +#define ITEM_SHOCK_DRIVE 428 +#define ITEM_BURN_DRIVE 429 +#define ITEM_CHILL_DRIVE 430 +#define ITEM_FIRE_GEM 431 +#define ITEM_WATER_GEM 432 +#define ITEM_ELECTRIC_GEM 433 +#define ITEM_GRASS_GEM 434 +#define ITEM_ICE_GEM 435 +#define ITEM_FIGHTING_GEM 436 +#define ITEM_POISON_GEM 437 +#define ITEM_GROUND_GEM 438 +#define ITEM_FLYING_GEM 439 +#define ITEM_PSYCHIC_GEM 440 +#define ITEM_BUG_GEM 441 +#define ITEM_ROCK_GEM 442 +#define ITEM_GHOST_GEM 443 +#define ITEM_DRAGON_GEM 444 +#define ITEM_DARK_GEM 445 +#define ITEM_STEEL_GEM 446 +#define ITEM_NORMAL_GEM 447 +#define ITEM_FAIRY_GEM 448 // Gen6 Items -#define ITEM_ASSAULT_VEST 448 -#define ITEM_PIXIE_PLATE 449 -#define ITEM_SAFETY_GOGGLES 450 -#define ITEM_GENGARITE 451 -#define ITEM_GARDEVOIRITE 452 -#define ITEM_AMPHAROSITE 453 -#define ITEM_VENUSAURITE 454 -#define ITEM_CHARIZARDITE_X 455 -#define ITEM_BLASTOISINITE 456 -#define ITEM_MEWTWONITE_X 457 -#define ITEM_MEWTWONITE_Y 458 -#define ITEM_BLAZIKENITE 459 -#define ITEM_MEDICHAMITE 460 -#define ITEM_HOUNDOOMINITE 461 -#define ITEM_AGGRONITE 462 -#define ITEM_BANETTITE 463 -#define ITEM_TYRANITARITE 464 -#define ITEM_SCIZORITE 465 -#define ITEM_PINSIRITE 466 -#define ITEM_AERODACTYLITE 467 -#define ITEM_LUCARIONITE 468 -#define ITEM_ABOMASITE 469 -#define ITEM_KANGASKHANITE 470 -#define ITEM_GYARADOSITE 471 -#define ITEM_ABSOLITE 472 -#define ITEM_CHARIZARDITE_Y 473 -#define ITEM_ALAKAZITE 474 -#define ITEM_HERACRONITE 475 -#define ITEM_MAWILITE 476 -#define ITEM_MANECTITE 477 -#define ITEM_GARCHOMPITE 478 -#define ITEM_LATIASITE 479 -#define ITEM_LATIOSITE 480 -#define ITEM_SWAMPERTITE 481 -#define ITEM_SCEPTILITE 482 -#define ITEM_SABLENITE 483 -#define ITEM_ALTARIANITE 484 -#define ITEM_GALLADITE 485 -#define ITEM_AUDINITE 486 -#define ITEM_METAGROSSITE 487 -#define ITEM_SHARPEDONITE 488 -#define ITEM_SLOWBRONITE 489 -#define ITEM_STEELIXITE 490 -#define ITEM_PIDGEOTITE 491 -#define ITEM_GLALITITE 492 -#define ITEM_DIANCITE 493 -#define ITEM_CAMERUPTITE 494 -#define ITEM_LOPUNNITE 495 -#define ITEM_SALAMENCITE 496 -#define ITEM_BEEDRILLITE 497 -#define ITEM_MEGA_BRACELET 498 +#define ITEM_ASSAULT_VEST 449 +#define ITEM_PIXIE_PLATE 450 +#define ITEM_SAFETY_GOGGLES 451 +#define ITEM_GENGARITE 452 +#define ITEM_GARDEVOIRITE 453 +#define ITEM_AMPHAROSITE 454 +#define ITEM_VENUSAURITE 455 +#define ITEM_CHARIZARDITE_X 456 +#define ITEM_BLASTOISINITE 457 +#define ITEM_MEWTWONITE_X 458 +#define ITEM_MEWTWONITE_Y 459 +#define ITEM_BLAZIKENITE 460 +#define ITEM_MEDICHAMITE 461 +#define ITEM_HOUNDOOMINITE 462 +#define ITEM_AGGRONITE 463 +#define ITEM_BANETTITE 464 +#define ITEM_TYRANITARITE 465 +#define ITEM_SCIZORITE 466 +#define ITEM_PINSIRITE 467 +#define ITEM_AERODACTYLITE 468 +#define ITEM_LUCARIONITE 469 +#define ITEM_ABOMASITE 470 +#define ITEM_KANGASKHANITE 471 +#define ITEM_GYARADOSITE 472 +#define ITEM_ABSOLITE 473 +#define ITEM_CHARIZARDITE_Y 474 +#define ITEM_ALAKAZITE 475 +#define ITEM_HERACRONITE 476 +#define ITEM_MAWILITE 477 +#define ITEM_MANECTITE 478 +#define ITEM_GARCHOMPITE 479 +#define ITEM_LATIASITE 480 +#define ITEM_LATIOSITE 481 +#define ITEM_SWAMPERTITE 482 +#define ITEM_SCEPTILITE 483 +#define ITEM_SABLENITE 484 +#define ITEM_ALTARIANITE 485 +#define ITEM_GALLADITE 486 +#define ITEM_AUDINITE 487 +#define ITEM_METAGROSSITE 488 +#define ITEM_SHARPEDONITE 489 +#define ITEM_SLOWBRONITE 490 +#define ITEM_STEELIXITE 491 +#define ITEM_PIDGEOTITE 492 +#define ITEM_GLALITITE 493 +#define ITEM_DIANCITE 494 +#define ITEM_CAMERUPTITE 495 +#define ITEM_LOPUNNITE 496 +#define ITEM_SALAMENCITE 497 +#define ITEM_BEEDRILLITE 498 +#define ITEM_MEGA_BRACELET 499 // Gen7 hold effects -#define ITEM_PROTECTIVE_PADS 499 -#define ITEM_TERRAIN_EXTENDER 500 -#define ITEM_ELECTRIC_SEED 501 -#define ITEM_GRASSY_SEED 502 -#define ITEM_MISTY_SEED 503 -#define ITEM_PSYCHIC_SEED 504 -#define ITEM_ADRENALINE_ORB 505 +#define ITEM_PROTECTIVE_PADS 500 +#define ITEM_TERRAIN_EXTENDER 501 +#define ITEM_ELECTRIC_SEED 502 +#define ITEM_GRASSY_SEED 503 +#define ITEM_MISTY_SEED 504 +#define ITEM_PSYCHIC_SEED 505 +#define ITEM_ADRENALINE_ORB 506 -#define ITEMS_COUNT 506 +#define ITEMS_COUNT 507 #define ITEM_FIELD_ARROW ITEMS_COUNT #define FIRST_BERRY_INDEX ITEM_CHERI_BERRY diff --git a/include/item_use.h b/include/item_use.h index 37343f6e7..31221aa09 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -51,5 +51,6 @@ void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); void sub_80FDD10(u8); +void ItemUseOutOfBattle_Honey(u8); #endif // GUARD_ITEM_USE_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a5b6e46f4..b832d7e05 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10503,6 +10503,7 @@ static void atkE5_pickup(void) s32 i; u16 species, heldItem; u8 ability; + u8 level; if (InBattlePike()) { @@ -10537,6 +10538,10 @@ static void atkE5_pickup(void) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); + level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); + u8 lvlDivBy10 = (level - 1) / 10; + if (lvlDivBy10 > 9) + lvlDivBy10 = 9; if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY)) ability = gBaseStats[species].ability2; @@ -10551,9 +10556,6 @@ static void atkE5_pickup(void) { s32 j; s32 rand = Random() % 100; - u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10; - if (lvlDivBy10 > 9) - lvlDivBy10 = 9; for (j = 0; j < 9; j++) { @@ -10569,6 +10571,12 @@ static void atkE5_pickup(void) } } } + else if (ability == ABILITY_HONEY_GATHER + && species != 0 + && species != SPECIES_EGG + && heldItem == ITEM_NONE + && (Random()%100 <= lvlDivBy10*5+5)) + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, ITEM_HONEY); } } diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index e20edbd64..733bbf317 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -877,6 +877,9 @@ const u32 gItemIconPalette_DreadPlate[] = INCBIN_U32("graphics/items/icon_palett const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/iron_plate.4bpp.lz"); const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/iron_plate.gbapal.lz"); +const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); +const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); + // Gen 5 Items const u32 gItemIcon_Eviolite[] = INCBIN_U32("graphics/items/icons/eviolite.4bpp.lz"); diff --git a/src/data/item_icon_table.h b/src/data/item_icon_table.h index 2b160ae20..e2c9d673b 100644 --- a/src/data/item_icon_table.h +++ b/src/data/item_icon_table.h @@ -449,6 +449,7 @@ const u32 *const gItemIconTable[][2] = [ITEM_DRACO_PLATE] = {gItemIcon_DracoPlate, gItemIconPalette_DracoPlate}, [ITEM_DREAD_PLATE] = {gItemIcon_DreadPlate, gItemIconPalette_DreadPlate}, [ITEM_IRON_PLATE] = {gItemIcon_IronPlate, gItemIconPalette_IronPlate}, + [ITEM_HONEY] = {gItemIcon_Honey, gItemIconPalette_Honey}, // Gen 5 Items [ITEM_EVIOLITE] = {gItemIcon_Eviolite, gItemIconPalette_Eviolite}, [ITEM_FLOAT_STONE] = {gItemIcon_FloatStone, gItemIconPalette_FloatStone}, diff --git a/src/data/items.h b/src/data/items.h index 6751b018e..ee47c7f89 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9136,4 +9136,21 @@ const struct Item gItems[] = .battleUseFunc = NULL, .secondaryId = 0, }, + [ITEM_HONEY] = + { + .name = _("Honey"), + .itemId = ITEM_HONEY, + .price = 100, + .holdEffect = HOLD_EFFECT_NONE, + .holdEffectParam = 0, + .description = gHoneyItemDescription, + .importance = 0, + .unk19 = 0, + .pocket = POCKET_ITEMS, + .type = 4, + .fieldUseFunc = ItemUseOutOfBattle_Honey, + .battleUsage = 0, + .battleUseFunc = NULL, + .secondaryId = 0, + }, }; diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index 57671d1e7..48584179d 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -452,3 +452,4 @@ const u8 gGrassySeedItemDescription[] = _("Boosts Defense on\nGrassy Terrain,\nb const u8 gMistySeedItemDescription[] = _("Boosts Sp. Def. on\nMisty Terrain,\nbut only one time."); const u8 gPsychicSeedItemDescription[] = _("Boosts Sp. Def. on\nPsychic Terrain,\nbut only one time."); const u8 gAdrenalineOrbItemDescription[] = _("Boosts Speed if the\nuser is intimidated,\nbut only one time."); +const u8 gHoneyItemDescription[] = _("A sweet honey that\nattracts wild Pokémon\nin grass or on trees."); diff --git a/src/item_use.c b/src/item_use.c index 4d225d8b0..a20aecc64 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1119,3 +1119,13 @@ void ItemUseOutOfBattle_CannotUse(u8 taskId) { DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); } + +void ItemUseOutOfBattle_Honey(u8 taskId) +{ + //As a placeholder, just acts like White Flute + FlagSet(FLAG_SYS_ENC_UP_ITEM); + FlagClear(FLAG_SYS_ENC_DOWN_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); + gTasks[taskId].data[8] = 0; + gTasks[taskId].func = sub_80FE1D0; +} diff --git a/src/wild_encounter.c b/src/wild_encounter.c index b860da13e..be97c73ac 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -487,6 +487,12 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == 8) encounterRate /= 2; + else if (ability == ABILITY_SNOW_CLOAK && gSaveBlock1Ptr->weather == 4) + encounterRate /= 2; + else if (ability == ABILITY_QUICK_FEET && gSaveBlock1Ptr->weather == 8) + encounterRate /= 2; + else if (ability == ABILITY_NO_GUARD) + encounterRate = encounterRate * 150 / 100; } if (encounterRate > 2880) encounterRate = 2880; From 2cfa5ea326fbeb253bc5de00d4d2018d3982f7ec Mon Sep 17 00:00:00 2001 From: Fontbane <36677462+Fontbane@users.noreply.github.com> Date: Mon, 25 Mar 2019 19:00:46 -0400 Subject: [PATCH 3/8] Fixed Honey And updated gitignore --- .gitignore | 2 ++ include/graphics.h | 2 ++ src/battle_script_commands.c | 9 +++++++-- src/data/graphics/items.h | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index dc782899d..4d8c4ba7b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ Thumbs.db build/ .DS_Store *.ddump +*.bin +*.ipch diff --git a/include/graphics.h b/include/graphics.h index ed25ae8e3..5fc33a794 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3940,6 +3940,8 @@ extern const u32 gItemIcon_DreadPlate[]; extern const u32 gItemIconPalette_DreadPlate[]; extern const u32 gItemIcon_IronPlate[]; extern const u32 gItemIconPalette_IronPlate[]; +extern const u32 gItemIcon_Honey[]; +extern const u32 gItemIconPalette_Honey[]; // Gen 5 Items extern const u32 gItemIcon_Eviolite[]; extern const u32 gItemIconPalette_Eviolite[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b832d7e05..a3d724c0a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10504,6 +10504,7 @@ static void atkE5_pickup(void) u16 species, heldItem; u8 ability; u8 level; + u8 lvlDivBy10; if (InBattlePike()) { @@ -10539,7 +10540,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - u8 lvlDivBy10 = (level - 1) / 10; + lvlDivBy10 = (level - 1) / 10; if (lvlDivBy10 > 9) lvlDivBy10 = 9; @@ -10576,7 +10577,11 @@ static void atkE5_pickup(void) && species != SPECIES_EGG && heldItem == ITEM_NONE && (Random()%100 <= lvlDivBy10*5+5)) - SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, ITEM_HONEY); + { + u16 honey = ITEM_HONEY; + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &honey); + break; + } } } diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index 733bbf317..b00a5b854 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -877,8 +877,8 @@ const u32 gItemIconPalette_DreadPlate[] = INCBIN_U32("graphics/items/icon_palett const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/iron_plate.4bpp.lz"); const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/iron_plate.gbapal.lz"); -const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); -const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); +const u32 gItemIcon_Honey[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); +const u32 gItemIconPalette_Honey[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); // Gen 5 Items From 562ad709151bf103a3e9ebdab9535f960f78f852 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Mon, 1 Apr 2019 23:07:21 -0400 Subject: [PATCH 4/8] Removed Gen 4 Ability field effects --- src/battle_script_commands.c | 12 +----------- src/wild_encounter.c | 6 ------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a3d724c0a..4563e587b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10540,7 +10540,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - lvlDivBy10 = (level - 1) / 10; + lvlDivBy10 = (level - 1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather if (lvlDivBy10 > 9) lvlDivBy10 = 9; @@ -10572,16 +10572,6 @@ static void atkE5_pickup(void) } } } - else if (ability == ABILITY_HONEY_GATHER - && species != 0 - && species != SPECIES_EGG - && heldItem == ITEM_NONE - && (Random()%100 <= lvlDivBy10*5+5)) - { - u16 honey = ITEM_HONEY; - SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &honey); - break; - } } } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index be97c73ac..b860da13e 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -487,12 +487,6 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == 8) encounterRate /= 2; - else if (ability == ABILITY_SNOW_CLOAK && gSaveBlock1Ptr->weather == 4) - encounterRate /= 2; - else if (ability == ABILITY_QUICK_FEET && gSaveBlock1Ptr->weather == 8) - encounterRate /= 2; - else if (ability == ABILITY_NO_GUARD) - encounterRate = encounterRate * 150 / 100; } if (encounterRate > 2880) encounterRate = 2880; From 7bc3cdf527ae2982bfcd99819595e0d753c5cd74 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 10:16:41 -0400 Subject: [PATCH 5/8] Delete level variable --- src/battle_script_commands.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4563e587b..9b1a3617f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10503,7 +10503,6 @@ static void atkE5_pickup(void) s32 i; u16 species, heldItem; u8 ability; - u8 level; u8 lvlDivBy10; if (InBattlePike()) @@ -10539,8 +10538,7 @@ static void atkE5_pickup(void) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - lvlDivBy10 = (level - 1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather + lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL)-1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather if (lvlDivBy10 > 9) lvlDivBy10 = 9; From e8dd8f93d13986c0d77eb57438186eebabaad90a Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 10:33:19 -0400 Subject: [PATCH 6/8] Remove Honey functionality --- data/battle_ai_scripts.s | 1 - include/item_use.h | 1 - src/data/items.h | 2 +- src/item_use.c | 9 --------- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 101889405..1f072b734 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3628,7 +3628,6 @@ AI_HPAware_DiscouragedEffectsWhenTargetLowHP: @ 82DE2B1 .byte EFFECT_LIGHT_SCREEN .byte EFFECT_OHKO .byte EFFECT_SUPER_FANG - .byte EFFECT_SUPER_FANG //Why is this here twice? .byte EFFECT_MIST .byte EFFECT_FOCUS_ENERGY .byte EFFECT_CONFUSE diff --git a/include/item_use.h b/include/item_use.h index 31221aa09..37343f6e7 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -51,6 +51,5 @@ void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); void sub_80FDD10(u8); -void ItemUseOutOfBattle_Honey(u8); #endif // GUARD_ITEM_USE_H diff --git a/src/data/items.h b/src/data/items.h index ee47c7f89..9ee44dcdc 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9148,7 +9148,7 @@ const struct Item gItems[] = .unk19 = 0, .pocket = POCKET_ITEMS, .type = 4, - .fieldUseFunc = ItemUseOutOfBattle_Honey, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = 0, .battleUseFunc = NULL, .secondaryId = 0, diff --git a/src/item_use.c b/src/item_use.c index a20aecc64..5cfd9b435 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1120,12 +1120,3 @@ void ItemUseOutOfBattle_CannotUse(u8 taskId) DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); } -void ItemUseOutOfBattle_Honey(u8 taskId) -{ - //As a placeholder, just acts like White Flute - FlagSet(FLAG_SYS_ENC_UP_ITEM); - FlagClear(FLAG_SYS_ENC_DOWN_ITEM); - StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); - gTasks[taskId].data[8] = 0; - gTasks[taskId].func = sub_80FE1D0; -} From 9ee2e1c99acd910c60096723c4a3b9b5be3934fe Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 12:03:09 -0400 Subject: [PATCH 7/8] Fix honey tab --- src/data/items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/items.h b/src/data/items.h index 9ee44dcdc..5738f7fba 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9136,7 +9136,7 @@ const struct Item gItems[] = .battleUseFunc = NULL, .secondaryId = 0, }, - [ITEM_HONEY] = + [ITEM_HONEY] = { .name = _("Honey"), .itemId = ITEM_HONEY, From af2f5031784b7f07434841cac189f20375281242 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 17:24:36 -0400 Subject: [PATCH 8/8] Fix gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4d8c4ba7b..dc782899d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,3 @@ Thumbs.db build/ .DS_Store *.ddump -*.bin -*.ipch