Skip to content

Commit

Permalink
Merge pull request #46 from FireEmblemUniverse/develop
Browse files Browse the repository at this point in the history
End of Phase 1
  • Loading branch information
Crazycolorz5 committed Jul 11, 2018
2 parents 7abf740 + a237979 commit 2725d6f
Show file tree
Hide file tree
Showing 76 changed files with 6,899 additions and 935 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -60,3 +60,4 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk
*.csv#
55 changes: 54 additions & 1 deletion Custom Definitions.event
@@ -1,3 +1,5 @@


#define FreeSpace 0xb2a610
#define FreeSpaceBLRange 0x1c1ec0

Expand All @@ -13,7 +15,12 @@
#ifndef ClassTable
#define ClassTable 0x807110
#endif

#ifndef BattleQuoteTable
#define BattleQuoteTable 0x9EC6BC
#endif
#ifndef DeathQuoteTable
#define DeathQuoteTable 0x9ECD4C
#endif

#define LunarBrace MoonBracelet
#define SolarBrace SunBracelet
Expand All @@ -22,6 +29,7 @@

//Class definitions
#define BlitzLord 0x2
#define VedgeLord BlitzLord
#define VoidMonster 0x3
#define VoidMaster 0x4

Expand All @@ -32,14 +40,23 @@
#define Chiva 0x4
#define Verge 0x5
#define Anna 0x6
#define Keanu 0x7
#define Boo 0x8
#define Aggie 0x9
#define Fanni 0xD
#define Murat 0xF
#define Ersatz 0x1F

#define Jazzak 0x42
#define Hecwood 0x48
#define Elitor 0x49
#define Dennis 0x50

#define Ximena 0xA

#define Grudge 0x4A
#define Ch5Generic 0x8A

//Item definitions
#define BlitzAxe Rapier
#define ExtraBow ShortBow
Expand All @@ -49,5 +66,41 @@
#define HuntersBowIconID 0xAE
#define RunicBow 0xBE
#define RunicBowIconID PiercingBowIconID //TODO
#define PowerGem BlackGem

//Chapter definitions
#define Chapter5 0x6
#define Chapter5Map 0x1F
#define Chapter5Changes 0x20
#define Chapter5Events 0x21
#define Chapter6 0x7

#define Coords(xcoord,ycoord) "(ycoord<<16)|xcoord"
#define TileChange(X,Y) "SETVAL 0xB Coords(X,Y) ; TILECHANGE 0xFFFF"
#define Every3Turns(CondID1,CondID2,CondID3,EventID1,EventID2,Pointer) "CHECK_EVENTID EventID1;BNE CondID1 0x0 0xC;CHECK_EVENTID EventID2;BNE CondID2 0x0 0xC;CALL Pointer;ENUT EventID1;ENUT EventID2;GOTO CondID3;LABEL CondID2;ENUF EventID2;GOTO CondID3;LABEL CondID1;ENUF EventID1;LABEL CondID3"
#define FadeOutMusic "MUSCMID 0x7FFF"
#define GiveItem(Item,Character) "SMOV 0x3 Item ; GIVEITEMTO Character"
#define GuardAI GuardTileAI
#define EndA2 ENDA
#define EndUnit UNIT
#define EndConvo "CALL $9EE2C4"

//#define DeathQuote(Character,Chapter,EventID,TextID) "SHORT Character; BYTE 0xFF Chapter; SHORT EventID TextID 0 0"
#define AllChapters 0xFF

//Equip definitions
#define WTYPE_SWORD 0x00
#define WTYPE_BLADE 0x00
#define WTYPE_LANCE 0x01
#define WTYPE_SPEAR 0x01
#define WTYPE_AXE 0x02
#define WTYPE_BOW 0x03
#define WTYPE_STAFF 0x04
#define WTYPE_ANIMA 0x05
#define WTYPE_LIGHT 0x06
#define WTYPE_ELDER 0x07
#define WTYPE_DARK 0x07

// #define __DEBUG__ // Uncomment to get the Debug startup menu :p
#define SpecifiedBattleConvo(Character1,Character2,Chapter,EventID,TextID) "BYTE Character1 0x0 Character2 0x0 Chapter 0x0 0x0 EventID ; SHORT TextID 0x0 0x0 0x0"
#define UnspecifiedBattleConvo(Character,Chapter,EventID,TextID) "BYTE Character 0x0 0x0 0x0 Chapter 0x0 EventID 0x0 ; SHORT TextID 0x0 0x0 0x0 ; BYTE 0x0 0x0 Character 0x0 Chapter 0x0 EventID 0x0 ; SHORT TextID 0x0 0x0 0x0"
34 changes: 34 additions & 0 deletions Engine Hacks/CheckItem.asm
@@ -0,0 +1,34 @@

.thumb
.global CheckItem
.type CheckItem, %function

.equ DoesUnitHaveItem, 0x080179F8 @Params: r0=char data ptr, r1=item id to search for

.macro blh to, reg
ldr \reg, =\to
mov lr, \reg
.short 0xF800
.endm

CheckItem:
push { lr }
ldr r0, =#0x03004E50
ldr r0, [ r0 ] @ Get current unit's character struct
ldr r1, =#0x030004BC
ldr r1, [ r1 ] @ Get item specified
blh DoesUnitHaveItem, r2

ldr r1, =#0x030004E8 @ Offset of slot 0xC
cmp r0, #0x00
beq False
mov r2, #0x01
b End

False:
mov r2, #0x00

End:
str r2, [ r1 ]
pop { r0 }
bx r0
Binary file added Engine Hacks/CheckItem.elf
Binary file not shown.
3 changes: 2 additions & 1 deletion Engine Hacks/Skill System/Battle Calculations.event
Expand Up @@ -28,6 +28,7 @@ POIN LuckySeven OddRhythm EvenRhythm QuickBurn SlowBurn
POIN Demoiselle Gentilhomme MaleficAura Intimidate Tantivy Focus Inspiration Charm Solidarity VoiceOfPeace Anathema LilysPoise Charisma
POIN ElbowRoom NaturalCover Gamble FieryBlood LifeAndDeath WindDisciple Hawkeye LightWeight
POIN UpWithArch
POIN AxefaithHit
#ifdef __GBA_LETHALITY__
POIN LethalitySkill Bane
#else
Expand All @@ -37,7 +38,7 @@ POIN LethalitySkill NonGBALethalitySkill Bane
POIN CriticalCheck

//add any new ones before here
POIN 0
WORD 0

rewriteRangeMap:
#incbin "Internals/rewriteRangeMap.dmp"
Expand Down
Binary file added Engine Hacks/Skill System/Blade Skills/AxeFaith.dmp
Binary file not shown.
53 changes: 53 additions & 0 deletions Engine Hacks/Skill System/Blade Skills/AxeFaith.s
@@ -0,0 +1,53 @@
.thumb
.equ AxeFaithID, SkillTester+4

push {r4-r7, lr}

@Check if unit has skill
ldr r0, SkillTester
mov lr, r0
mov r0, r4
ldr r1, AxeFaithID
.short 0xf800
cmp r0, #0
beq NoSkill

@Unit has skill, check to see if unit has an axe equipped
mov r0, #0x50 @Move to the attacking unit weapon type.
ldrb r0, [r4, r0] @Load the attacking unit weapon type.
cmp r0, #2 @Is it Axe?
bne NoSkill @If not, goto end

@Add to Hit
mov r0, #0x19
ldrh r0, [r4,r0] @load luck
lsr r1, r0, #1 @put half luck in r1
add r0, r0, r1 @add back together.
mov r3, #0x60
ldrh r1, [r4,r3] @load hit
add r1, r0 @Increase hit by 1.5x Luck.
strh r1, [r4,r3] @store.

NoSkill:
pop {r4-r7}
pop {r0}
bx r0

.align
SkillTester:
@POIN SkillTester
@WORD AxeFaithID


@@Axe Faith
@@for axe faith Ive settled on axes dont break and hit += luck * 1.5

@@other things said on the matter
@@+10 Hit if post-enemy evasion hit is above 40 but below 70.

@@but if you follow the Axe Faith
@@anything over 49 is actually 100




13 changes: 10 additions & 3 deletions Engine Hacks/Skill System/Master Skill Installer.event
Expand Up @@ -317,15 +317,22 @@ CriticalIDList:
BYTE CriticalForceID KillingMachineID
ALIGN 4

AxefaithHit:
#incbin "Blade Skills/Axefaith.dmp"
POIN SkillTester
WORD AxeFaithID

LethalitySkill:
#incbin "Other Skills/LethalitySkill.dmp"
POIN SkillTester
WORD LethalityID

Armsthrift:
#incbin "Other Skills/Armsthrift.dmp"
AxeFaithArmsthrift:
ArmsthriftAxeFaith:
#incbin "Other Skills/armsthriftaxefaith.dmp"
POIN SkillTester|1
WORD ArmsthriftID
WORD ArmsthriftID AxeFaithID

CritUpSkill:
#incbin "Other Skills/CritUpSkill.dmp"
Expand Down Expand Up @@ -395,4 +402,4 @@ POIN Skill_Getter
#include "Stan Skills/HeroesMovement/HeroesMovement.event"
#include "Post Combat Skills/Post Combat Skills Installer.event"

#include "Skill Removal Menu/RemoveSkillMenu.event"
#include "Skill Removal Menu/RemoveSkillMenu.event"
3 changes: 2 additions & 1 deletion Engine Hacks/Skill System/Other Skills/armsthrift.s
Expand Up @@ -6,6 +6,7 @@ _ReturnLocation = 0x0802B828+1

LUnitHasSkill = EALiterals+0x00
LArmsthriftSkillID = EALiterals+0x04
LAxefaithSkillID = EALiterals+0x08

@ Hook from 0802B7F8
ArmsthriftHook:
Expand Down Expand Up @@ -34,7 +35,7 @@ NonMiss:
bl BXR3

cmp r0, #0 @ compare result
beq NonArmsthrift @ goto NonArmsthrift if zero (unit doesn't have armsthrift)
beq NonArmsthrift @ goto NonArmsthrift if zero (unit does not have armsthrift)

@ Getting Armsthrift proc chance (=luck)
ldrb r0, [r5, #0x19] @ BattleUnit.luck
Expand Down
Binary file not shown.
108 changes: 108 additions & 0 deletions Engine Hacks/Skill System/Other Skills/armsthriftaxefaith.s
@@ -0,0 +1,108 @@
.thumb

WTYPE_AXE = 0x02
GetItemAfterUse = 0x08016AEC+1
RollBattleRN = 0x0802A52C+1
GetEquippedWeapon = 0x08016B28+1
GetWeaponType = 0x08017548+1
_ReturnLocation = 0x0802B828+1

LUnitHasSkill = EALiterals+0x00
LArmsthriftSkillID = EALiterals+0x04
LAxeFaithSkillID = EALiterals+0x08

@ Hook from 0802B7F8
ArmsthriftHook:
@ r0 is Current Round Data (first word)
@ r5 is Attacker
@ Nothing needs to be saved (we branch back to the function epilogue)

mov r1, #2 @ Miss flag

tst r0, r1 @ <void> = CurrentRound & 2
beq NonMiss @ goto NonMiss if zero (Miss flag is not set)

ldr r1, [r5, #0x4C] @ BattleUnit.weaponAttributes
mov r2, #(0x02 | 0x80) @ IA_MAGIC | IA_UNCOUNTERABLE

tst r1, r2 @ <void> = BattleUnit.weaponAttributes & (IA_MAGIC | IA_UNCOUNTERABLE)
beq End @ goto End if zero (weapon is neither magic or uncounterable)

NonMiss:
@ ACTUAL ARMSTHRIFT CHECK BEGIN

mov r0, r5 @ arg r0 = (Battle) Unit
ldr r1, LArmsthriftSkillID @ arg r1 = Skill Index

ldr r3, LUnitHasSkill
bl BXR3

cmp r0, #0 @ compare result
beq NonArmsthrift @ goto NonArmsthrift if zero (unit does not have armsthrift)

@ Getting Armsthrift proc chance (=luck)
ldrb r0, [r5, #0x19] @ BattleUnit.luck
@ lsl r0, #1 @ multiply by 2

@ ROLL
ldr r3, =RollBattleRN
bl BXR3

cmp r0, #0 @ compare result
bne End @ goto End if non-zero (Armsthrift proc)

NonArmsthrift:
@ ACTUAL ARMSTHRIFT CHECK END

@2wb: begin AxeFaith check
mov r0, r5 @ arg r0 = (Battle) Unit
ldr r1, LAxeFaithSkillID @ arg r1 = Skill Index

ldr r3, LUnitHasSkill
bl BXR3

cmp r0, #0 @ compare result
beq NonAxeFaith @ goto NonAxeFaith if zero (unit does not have axefaith)

@ Unit has axefaith
@ Are they using an axe?
mov r0, r5 @arg r0 = unit
ldr r3, =GetEquippedWeapon
bl BXR3

ldr r3, =GetWeaponType
bl BXR3

cmp r0, #WTYPE_AXE @ #0x02
beq End @ goto End if true (AxeFaith triggers)

NonAxeFaith:
mov r4, #0x48 @ offsetof(BattleUnit.weaponAfter)

ldrh r0, [r5, r4] @ Load weapon

ldr r3, =GetItemAfterUse
bl BXR3

strh r0, [r5, r4] @ Store used weapon

cmp r0, #0 @ Compare weapon
bne End @ goto End if weapon != 0

mov r1, #0x7D @ BattleUnit.weaponBroke
mov r0, #1

strb r0, [r5, r1] @ BattleUnit.weaponBroke = true

End:
ldr r3, =_ReturnLocation
BXR3:
bx r3

.ltorg
.align

EALiterals:
@ POIN SkillTester|1
@ WORD ArmsthriftID
@ WORD AxeFaithID
Binary file added Engine Hacks/Skill System/Skill Icons/Axefaith.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion Engine Hacks/Skill System/skill_definitions.event
Expand Up @@ -155,4 +155,6 @@
#define SolidarityID 154 //DONE
#define FortressDefenseID 155 //DONE
#define FortressResistanceID 156 //DONE
#define ForesightID 157 //DONE
#define ForesightID 157 //DONE
#define AxeFaithID 158 //DONE
#define AxefaithID AxeFaithID //Alias
1 change: 0 additions & 1 deletion Engine Hacks/Skill System/skill_descriptions.event
Expand Up @@ -160,4 +160,3 @@ SkillDescription(HeroesLifeAndDeathID,SD_HeroesLifeAndDeath)
SkillDescription(CatchEmAllID,SD_CatchEmAll)
SkillDescription(VantagePlusID,SD_Vantage_Plus)
SkillDescription(HawkeyeID,SD_Hawkeye)
SkillDescription(LunaPlusID,SD_Luna_Plus)

0 comments on commit 2725d6f

Please sign in to comment.