From d8066afaba961691b84f7e36d6a1f878fd4befd5 Mon Sep 17 00:00:00 2001 From: JesterWizard Date: Thu, 3 Apr 2025 20:50:04 +0100 Subject: [PATCH 1/2] SKILL - Encumbered --- .../Necessary/StatGetters/Movement.event | 1 + .../SkillSystem/Internals/SkillSystem.event | 1 + .../Encumbered/AssembleLyn.bat | 26 ++++++ .../Encumbered/Encumbered.lyn.event | 9 ++ .../Encumbered/Encumbered.s | 86 +++++++++++++++++++ .../StatModifierSkills.event | 5 ++ .../SkillSystem/skill_definitions.event | 5 ++ .../SkillSystem/skill_descriptions.event | 3 +- EngineHacks/SkillSystem/skill_icons.event | 3 + Text/skilldesc_text.txt | 7 +- 10 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/AssembleLyn.bat create mode 100644 EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.lyn.event create mode 100644 EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.s diff --git a/EngineHacks/Necessary/StatGetters/Movement.event b/EngineHacks/Necessary/StatGetters/Movement.event index 5d2c60d8..5e907822 100644 --- a/EngineHacks/Necessary/StatGetters/Movement.event +++ b/EngineHacks/Necessary/StatGetters/Movement.event @@ -5,6 +5,7 @@ ALIGN 4 pMovModifiers: // Movement POIN prAddUnitBaseMov prAddUnitMovBonus (prGetItemMovBonus-1) prItemPassiveMov prRallyMov prSkillCelerity prSkillPoise prArmorMarchCheck prDelivererBonus prEquipmentBonusMov + POIN Encumbered #ifdef STAIRS_ASM POIN StairsMoveDebuff-1 #endif diff --git a/EngineHacks/SkillSystem/Internals/SkillSystem.event b/EngineHacks/SkillSystem/Internals/SkillSystem.event index 5353fc65..9edb209b 100644 --- a/EngineHacks/SkillSystem/Internals/SkillSystem.event +++ b/EngineHacks/SkillSystem/Internals/SkillSystem.event @@ -181,6 +181,7 @@ BYTE BracingStanceID DartingStanceID FierceStanceID KestrelStanceID MirrorStance BYTE ExpertiseID BYTE SlayerID NullifyID //effectiveness stuff BYTE BlackMagicID +BYTE EncumberedID BYTE FortressDefenseID FortressResistanceID ForesightID AxefaithID FullMetalBodyID LiquidOozeID DevilsLuckID DevilsPactID DevilsWhimID DevilsTrainingID PoisonStrikeID GrislyWoundID HexID BarricadeID BarricadePlusID PointBlankID PerfectionistID PuissanceID BattleVeteranID HolyAuraID SilentPrideID LoyaltyID ThunderstormID OutriderID HeavyStrikesID ChargeID InfiltratorID VanityID MageSlayerID KnightAspirantID DisciplinePlusID HeroID SealMagID DriveStrID DriveMagID DriveSpdID DriveDefID DriveResID QuickRiposteID ResolveID InsightID VigilanceID DauntID BloodTideID WhitePoolID NightTideID PrescienceID DefiantAvoID DefiantCritID DefiantStrID DefiantMagID DefiantSklID DefiantSpdID DefiantLckID DefiantDefID DefiantResID ShortShieldID TowerShieldID TowerShieldPlusID IndoorFighterID OutdoorFighterID TomeRangeUpID AlertStanceID AlertStancePlusID CoronaID FlareID TempestID SerenityID PetrifyID EnrageID DeadeyeID DragonFangID FortuneID //this hasnt been updated in like a year and a half lol /* //NOT WORKING (or they should not be affected by nihil) diff --git a/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/AssembleLyn.bat b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/AssembleLyn.bat new file mode 100644 index 00000000..b78658fe --- /dev/null +++ b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/AssembleLyn.bat @@ -0,0 +1,26 @@ +@echo off + +SET startDir="C:\devkitPro\devkitARM\bin\" +SET as="%startDir%arm-none-eabi-as" +SET LYN="C:\devkitPro\lyn.exe" + +@rem Assemble into an elf +%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf" + +if exist "Definitions.s" ( + + @rem Assemble definitions into a .elf if exists + %as% -g -mcpu=arm7tdmi -mthumb-interwork "Definitions.s" -o "Definitions.elf" + + @rem Assebmle into a .lyn.event with definitions + %LYN% "%~n1.elf" "Definitions.elf" > "%~n1.lyn.event" + + echo y | del "%~dp0Definitions.elf" +) else ( + @rem Assemble into a .lyn.event + %LYN% "%~n1.elf" > "%~n1.lyn.event" +) + +echo y | del "%~n1.elf" + +pause \ No newline at end of file diff --git a/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.lyn.event b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.lyn.event new file mode 100644 index 00000000..cbf863b9 --- /dev/null +++ b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.lyn.event @@ -0,0 +1,9 @@ +ALIGN 4 +PUSH +ORG CURRENTOFFSET+$1;Encumbered: +POP +WORD $1C04B5F0 $1C281C0D $68094918 +SHORT ((SkillTester-4-CURRENTOFFSET>>12)&$7FF)|$F000 ((SkillTester-4-CURRENTOFFSET>>1)&$7FF)|$F800 +WORD $D0252800 $46864816 $5C68211B $42982300 $F800D01E $68381C07 $68797CC0 $18407C49 $1C067EB9 $490F1C28 $F800468E $42B00840 $E00DDD00 $6A806828 $6A896869 $21014308 $D1024208 $2301E7FF $2302E001 $1AE4E7FF $1C291C20 $BC04BCF0 $4710 +POIN EncumberedID_Link +WORD $8019431 $80189B9 diff --git a/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.s b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.s new file mode 100644 index 00000000..fd6af79c --- /dev/null +++ b/EngineHacks/SkillSystem/Skills/StatModifierSkills/Encumbered/Encumbered.s @@ -0,0 +1,86 @@ +@Encumbered: If this unit is rescuing another unit who's CON is equal or higher than half this unit's AID, +@ unit gets -1 Mov. The penalty changes to -2 if this unit has Mounted AID calc +.thumb + +.equ GetUnit,0x08019430+1 +.equ GetUnitAid, 0x80189B8+1 + +.type Encumbered, %function +.global Encumbered +Encumbered: +push {r4-r7, lr} +mov r4, r0 @ stat value +mov r5, r1 @ unit + +mov r0, r5 +ldr r1, =EncumberedID_Link +ldr r1, [r1] +bl SkillTester +cmp r0, #0 +beq End + +@ Get the rescuee unit struct +ldr r0, =GetUnit +mov r14, r0 +mov r1, #0x1B +ldrb r0, [r5, r1] +mov r3, #0 +cmp r0, r3 +beq End @if the unit isn't rescuing, branch to end +.short 0xF800 +@ unit struct pointer in r0 +mov r7, r0 + +@Now load the rescuee unit's CON +ldr r0, [r7, #0x0] +ldrb r0, [r0, #0x13] @unit CON +ldr r1, [r7, #0x04] +ldrb r1, [r1, #0x11] @class CON +add r0, r1 +ldrb r1, [r7, #0x1A] @CON bonus +mov r6, r0 @r6 contains rescuee CON + +@Now load the rescuer unit's AID +mov r0, r5 +ldr r1, =GetUnitAid +mov r14, r1 +.short 0xF800 +lsr r0, #1 @r0 now has the rescuer's AID from the GetUnitAid function and we're dividing it by 2 +cmp r0, r6 @compare the rescuer's AID/2 to the rescuee's CON +ble CheckForMount @if the halved AID is less than or equal to the CON, check for mount +b End + +@ Check if the rescuer is mounted +CheckForMount: +ldr r0,[r5] @load the unit's character data +ldr r0,[r0,#0x28] @load the ability 1 bitfield +ldr r1,[r5,#0x4] @load the unit's class data +ldr r1,[r1,#0x28] @load the ability 1 bitfield +orr r0,r1 @perform an OR logical operation on the two bitfields +mov r1,#0x1 @add 1 to the a seperate register to compare it to the bitfield for mounted aid (which is 1) +tst r0,r1 @compare them +bne SubtractTwo @if equal, the rescuer is mounted, subtract 2 from their movement +b SubtractOne @else subtract 1 + +SubtractOne: +mov r3, #0x01 +b ApplySkill + +SubtractTwo: +mov r3, #0x02 +b ApplySkill + +@subtract bonus to movement value +ApplySkill: +sub r4, r3 + +End: +mov r0, r4 @ value +mov r1, r5 @ unit +pop {r4-r7} +pop {r2} +bx r2 +.ltorg + + + diff --git a/EngineHacks/SkillSystem/Skills/StatModifierSkills/StatModifierSkills.event b/EngineHacks/SkillSystem/Skills/StatModifierSkills/StatModifierSkills.event index bd14075e..58129057 100644 --- a/EngineHacks/SkillSystem/Skills/StatModifierSkills/StatModifierSkills.event +++ b/EngineHacks/SkillSystem/Skills/StatModifierSkills/StatModifierSkills.event @@ -14,6 +14,11 @@ prResolve: POIN SkillTester WORD ResolveID +#include "Encumbered/Encumbered.lyn.event" +ALIGN 4 +EncumberedID_Link: +WORD EncumberedID + #include "PushSkills/PushSkills.event" #include "LullSkills/LullSkills.event" diff --git a/EngineHacks/SkillSystem/skill_definitions.event b/EngineHacks/SkillSystem/skill_definitions.event index 3af6a81f..c20e8e5f 100644 --- a/EngineHacks/SkillSystem/skill_definitions.event +++ b/EngineHacks/SkillSystem/skill_definitions.event @@ -644,6 +644,11 @@ //By Jester #define DevilsTrainingID 183 +//Encumbered: If this unit is rescuing another unit who's CON is equal or higher than half this unit's AID, +//unit gets -1 Mov. The penalty changes to -2 if this unit has Mounted AID calc +//By Jester +#define EncumberedID 33 + //Down With Arch: If the hit lands, instantly kill the enemy unit. (Only if name starts with "Arch") #define DownWithArchID 255 diff --git a/EngineHacks/SkillSystem/skill_descriptions.event b/EngineHacks/SkillSystem/skill_descriptions.event index 522ef4c1..8fa01427 100644 --- a/EngineHacks/SkillSystem/skill_descriptions.event +++ b/EngineHacks/SkillSystem/skill_descriptions.event @@ -357,4 +357,5 @@ SkillDescription(BruteForceID,SD_Puissance) SkillDescription(DeityID,SD_Barricade) SkillDescription(AversionID,SD_Focus) // SkillDescription(AcrobatMinusID,SD_AcrobatMinus) -// SkillDescription(FlierID,SD_Flier) \ No newline at end of file +// SkillDescription(FlierID,SD_Flier) +// SkillDescription(EncumberedID, SD_Encumbered) \ No newline at end of file diff --git a/EngineHacks/SkillSystem/skill_icons.event b/EngineHacks/SkillSystem/skill_icons.event index bd391c3a..60cc4679 100644 --- a/EngineHacks/SkillSystem/skill_icons.event +++ b/EngineHacks/SkillSystem/skill_icons.event @@ -1107,5 +1107,8 @@ ORG SkillIcon(AcrobatMinusID) ORG SkillIcon(FlierID) #incbin "SkillIcons/Acrobat.dmp" +ORG SkillIcon(EncumberedID) +#incbin "SkillIcons/Acrobat.dmp" + ORG SkillIcons+0x8000 diff --git a/Text/skilldesc_text.txt b/Text/skilldesc_text.txt index e42b1c86..dd8a7af4 100644 --- a/Text/skilldesc_text.txt +++ b/Text/skilldesc_text.txt @@ -1506,4 +1506,9 @@ of the weapon triangle.[X] ## SD_CamaraderieAlt CamaraderieAlt: Grants +10 hit if[N] -there are allies within 2 tiles.[X] \ No newline at end of file +there are allies within 2 tiles.[X] + +// ## SD_Encumbered +// Encumbered: If rescuing and rescuee[N] +// CON > rescuer AID/2, rescuer MOV -1.[N] +// If rescuer mounted, then MOV -2.[X] \ No newline at end of file From dfd4bb15977841c5cdaa3a5d7feeff6ebdf1f290 Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 8 Apr 2025 12:33:45 -0400 Subject: [PATCH 2/2] Skill definitions fix --- EngineHacks/SkillSystem/skill_definitions.event | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EngineHacks/SkillSystem/skill_definitions.event b/EngineHacks/SkillSystem/skill_definitions.event index 626e9c01..65f22057 100644 --- a/EngineHacks/SkillSystem/skill_definitions.event +++ b/EngineHacks/SkillSystem/skill_definitions.event @@ -778,7 +778,8 @@ #define DazzleID 141 //Desperation: If HP < 50%, double attacks occur immediately. -#define DesperationID 33 //DONE by ??? (Initial Commit) +//DONE by ??? (Initial Commit) +#define DesperationID 255 //Assassinate: When initiating battle at 1 range: +2 Damage, double attacks occur before counter. //By Zeta