diff --git a/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.c b/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.c index d1aa732376..c1056a5522 100644 --- a/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.c +++ b/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.c @@ -41,24 +41,28 @@ s8 AreAllegiancesAllied(int left, int right); void StartUnitHpInfoWindow(struct Proc*); // headers -void TryAddAllyTargetList(struct Unit* unit); -void MakeTargetListForAdjacentAlly(struct Unit* unit); +void TryAddToReciprocalAidTargetList(struct Unit* unit); +void MakeReciprocalAidTargetList(struct Unit* unit); void TryDrawBackAllyToTargetList(struct Unit* unit); void MakeDrawBackTargetListForAdjacentAlly(struct Unit* unit); struct Vec2u GetDrawBackCoord(int x1, int x2, int y1, int y2); int DrawBackAction(struct MenuProc* menu); int DrawBack_Usability(struct MenuProc* menu); int DrawBack_Effect(struct MenuProc* menu); +void MakeSacrificeTargetList(struct Unit*); int Sacrifice_Usability(struct MenuProc* menu) { + if (gActiveUnit->curHP <= 1) { + return 3; // false + } if (gActiveUnit->state & US_CANTOING) { return 3; // false } if (SkillTester(gActiveUnit, SacrificeID_Link) == 0) { return 3; // false } - MakeTargetListForAdjacentHeal(gActiveUnit); + MakeSacrificeTargetList(gActiveUnit); if (GetTargetListSize()) { return 1; // usable } @@ -194,7 +198,7 @@ int DrawBackTargetAPress(struct TargetSelectionProc* targetProc, struct TargetEn int Sacrifice_Effect(struct MenuProc* menu) { - MakeTargetListForAdjacentHeal(gActiveUnit); + MakeSacrificeTargetList(gActiveUnit); StartTargetSelection(&gSacrificeTargetSelection); // returns TargetSelectionProc* return 7; // close menu and such } @@ -204,12 +208,15 @@ int ArdentSacrifice_Effect(struct MenuProc* menu) { return 7; // close menu and such } int ReciprocalAid_Effect(struct MenuProc* menu) { - MakeTargetListForAdjacentAlly(gActiveUnit); + MakeReciprocalAidTargetList(gActiveUnit); StartTargetSelection(&gReciprocalAidTargetSelection); // returns TargetSelectionProc* return 7; // close menu and such } int ArdentSacrifice_Usability(struct MenuProc* menu) { + if (gActiveUnit->curHP <= 1) { + return 3; // false + } if (gActiveUnit->state & US_CANTOING) { return 3; // false } @@ -230,7 +237,7 @@ int ReciprocalAid_Usability(struct MenuProc* menu) { if (SkillTester(gActiveUnit, ReciprocalAidID_Link) == 0) { return 3; // false } - MakeTargetListForAdjacentAlly(gActiveUnit); // calls InitTargets + MakeReciprocalAidTargetList(gActiveUnit); // calls InitTargets if (GetTargetListSize()) { return 1; // usable } @@ -244,11 +251,41 @@ int ReciprocalAid_Usability(struct MenuProc* menu) { + void TryAddToSacrificeTargetList(struct Unit* unit) { + + if (!AreAllegiancesAllied(gSubjectUnit->index, unit->index)) { + return; + } + + if (unit->state & US_RESCUED) { + return; + } + // if target is at full hp and not statused, exit + if ((unit->statusIndex == 0) && (unit->maxHP == unit->curHP)) { + return; + } + + AddTarget(unit->xPos, unit->yPos, unit->index, 0); + + return; +} +void MakeSacrificeTargetList(struct Unit* unit) { + int x = unit->xPos; + int y = unit->yPos; + + gSubjectUnit = unit; + + BmMapFill(gMapRange, 0); + + ForEachAdjacentUnit(x, y, TryAddToSacrificeTargetList); + + return; +} -void TryAddAllyTargetList(struct Unit* unit) { +void TryAddToReciprocalAidTargetList(struct Unit* unit) { if (!AreAllegiancesAllied(gSubjectUnit->index, unit->index)) { return; @@ -257,13 +294,20 @@ void TryAddAllyTargetList(struct Unit* unit) { if (unit->state & US_RESCUED) { return; } + // if both units are full hp, exit + if ((gSubjectUnit->maxHP == gSubjectUnit->curHP) && (unit->maxHP == unit->curHP)) { + return; + } + if ((unit->maxHP == unit->curHP) && (unit->maxHP < gSubjectUnit->curHP)) { + return; + } AddTarget(unit->xPos, unit->yPos, unit->index, 0); return; } -void MakeTargetListForAdjacentAlly(struct Unit* unit) { +void MakeReciprocalAidTargetList(struct Unit* unit) { int x = unit->xPos; int y = unit->yPos; @@ -271,7 +315,7 @@ void MakeTargetListForAdjacentAlly(struct Unit* unit) { BmMapFill(gMapRange, 0); - ForEachAdjacentUnit(x, y, TryAddAllyTargetList); + ForEachAdjacentUnit(x, y, TryAddToReciprocalAidTargetList); return; } diff --git a/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.lyn.event b/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.lyn.event index 59162c9538..abbe626796 100644 --- a/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.lyn.event +++ b/EngineHacks/SkillSystem/Skills/UnitMenuSkills/SacrificeDrawBack/Sacrifice.lyn.event @@ -1,7 +1,7 @@ ALIGN 4 PUSH ORG CURRENTOFFSET+$1;Sacrifice_Usability: -ORG CURRENTOFFSET+$70;SacrificeAction: +ORG CURRENTOFFSET+$7c;SacrificeAction: ORG CURRENTOFFSET+$118;ArdentSacrificeAction: ORG CURRENTOFFSET+$d0;ReciprocalAidAction: ORG CURRENTOFFSET+$e4;HealTargetInit: @@ -10,12 +10,14 @@ ORG CURRENTOFFSET+$34;ArdentSacrificeTargetAPress: ORG CURRENTOFFSET+$34;ReciprocalAidTargetAPress: ORG CURRENTOFFSET+$34;DrawBackTargetAPress: ORG CURRENTOFFSET+$34;Sacrifice_Effect: -ORG CURRENTOFFSET+$3c;ArdentSacrifice_Effect: +ORG CURRENTOFFSET+$38;ArdentSacrifice_Effect: ORG CURRENTOFFSET+$3c;ReciprocalAid_Effect: ORG CURRENTOFFSET+$38;ArdentSacrifice_Usability: -ORG CURRENTOFFSET+$70;ReciprocalAid_Usability: -ORG CURRENTOFFSET+$68;TryAddAllyTargetList: -ORG CURRENTOFFSET+$7c;MakeTargetListForAdjacentAlly: +ORG CURRENTOFFSET+$80;ReciprocalAid_Usability: +ORG CURRENTOFFSET+$68;TryAddToSacrificeTargetList: +ORG CURRENTOFFSET+$a0;MakeSacrificeTargetList: +ORG CURRENTOFFSET+$60;TryAddToReciprocalAidTargetList: +ORG CURRENTOFFSET+$d0;MakeReciprocalAidTargetList: ORG CURRENTOFFSET+$e4;DrawBack_Usability: ORG CURRENTOFFSET+$68;DrawBack_Effect: ORG CURRENTOFFSET+$38;DrawBackTargetInit: @@ -24,16 +26,16 @@ ORG CURRENTOFFSET+$b4;GetDrawBackCoord: ORG CURRENTOFFSET+$d2;TryDrawBackAllyToTargetList: ORG CURRENTOFFSET+$18e;MakeDrawBackTargetListForAdjacentAlly: POP -WORD $B082B580 $6078AF00 $681B4B14 $224068DB $D0014013 $E01A2303 $681A4B10 $681B4B10 $100019 $F0004B0F $1E03FDBD $2303D101 $4B0AE00D $18681B $F0004B0B $4B0BFDB3 $FDB0F000 $D0011E03 $E0002301 $182303 $B00246BD $BC02BC80 $46C04708 $3004E50 +WORD $B082B580 $6078AF00 $681B4B18 $61B7CDB $2B01161B $2303DC01 $4B14E021 $68DB681B $40132240 $2303D001 $4B10E019 $4B10681A $19681B $4B0F0010 $FE6AF000 $D1011E03 $E00C2303 $681B4B09 $F0000018 $4B0AFB23 $FE5EF000 $D0011E03 $E0002301 $182303 $B00246BD $BC02BC80 $46C04708 $3004E50 POIN SacrificeID_Link POIN SkillTester -WORD $8025E7D $804FD29 $B088B580 $6078AF00 $681B4B3D $4B3C68DA $2140681B $60DA430A $681B4B39 $4B3868DA $2140681B $60DA438A $681B4B35 $61B7CDB $61BB161B $7B5B4B33 $4B330018 $FD7AF000 $617B0003 $7CDB697B $161B061B $69BB613B $61FB3B01 $7C9B697B $161B061B $69FA60FB $18D3693B $429A68FA $68FADA03 $1AD3693B $697B61FB $5C9B2230 $F1B071B $E1B061B $68BB60BB $D01D2B00 $2B0168BB $68BBD00E $D00B2B02 $2B0368BB $68BBD008 $D0052B04 $2B0968BB $68BBD002 $D10B2B0B $2230697B $200F5C99 $54994381 $2230697B $200F5C99 $54994001 $681B4B0E $791B681B $4B0F001A $697B605A $791B681B $4B0C001A $69FA609A $619A4B0A $21014B0A $4B0A0018 $FD22F000 $182300 $B00846BD $BC02BC80 $46C04708 $3004E50 $203A958 $8019431 $30004B8 +WORD $804FD29 $B088B580 $6078AF00 $681B4B3D $4B3C68DA $2140681B $60DA430A $681B4B39 $4B3868DA $2140681B $60DA438A $681B4B35 $61B7CDB $61BB161B $7B5B4B33 $4B330018 $FE2AF000 $617B0003 $7CDB697B $161B061B $69BB613B $61FB3B01 $7C9B697B $161B061B $69FA60FB $18D3693B $429A68FA $68FADA03 $1AD3693B $697B61FB $5C9B2230 $F1B071B $E1B061B $68BB60BB $D01D2B00 $2B0168BB $68BBD00E $D00B2B02 $2B0368BB $68BBD008 $D0052B04 $2B0968BB $68BBD002 $D10B2B0B $2230697B $200F5C99 $54994381 $2230697B $200F5C99 $54994001 $681B4B0E $791B681B $4B0F001A $697B605A $791B681B $4B0C001A $69FA609A $619A4B0A $21014B0A $4B0A0018 $FDD2F000 $182300 $B00846BD $BC02BC80 $46C04708 $3004E50 $203A958 $8019431 $30004B8 POIN HarmAndHealEvent -WORD $800D07D $B088B580 $6078AF00 $681B4B2B $4B2A68DA $2140681B $60DA430A $681B4B27 $4B2668DA $2140681B $60DA438A $681B4B23 $61B7CDB $61BB161B $7B5B4B21 $4B210018 $FCEEF000 $617B0003 $7CDB697B $161B061B $69BB613B $61FB3B01 $7C9B697B $161B061B $69FA60FB $18D3693B $429A68FA $68FADA03 $1AD3693B $69FB61FB $DD012B0A $61FB230A $681B4B0E $791B681B $4B0F001A $697B605A $791B681B $4B0C001A $69FA609A $619A4B0A $21014B0A $4B0A0018 $FCBAF000 $182300 $B00846BD $BC02BC80 $46C04708 $3004E50 $203A958 $8019431 $30004B8 +WORD $800D07D $B088B580 $6078AF00 $681B4B2B $4B2A68DA $2140681B $60DA430A $681B4B27 $4B2668DA $2140681B $60DA438A $681B4B23 $61B7CDB $61BB161B $7B5B4B21 $4B210018 $FD9EF000 $617B0003 $7CDB697B $161B061B $69BB613B $61FB3B01 $7C9B697B $161B061B $69FA60FB $18D3693B $429A68FA $68FADA03 $1AD3693B $69FB61FB $DD012B0A $61FB230A $681B4B0E $791B681B $4B0F001A $697B605A $791B681B $4B0C001A $69FA609A $619A4B0A $21014B0A $4B0A0018 $FD6AF000 $182300 $B00846BD $BC02BC80 $46C04708 $3004E50 $203A958 $8019431 $30004B8 POIN HarmAndHealEvent -WORD $800D07D $B086B580 $6078AF00 $681B4B30 $4B2F68DA $2140681B $60DA430A $681B4B2C $4B2B68DA $2140681B $60DA438A $681B4B28 $61B7CDB $613B161B $7B5B4B26 $4B260018 $FC86F000 $60FB0003 $7CDB68FB $161B061B $230160BB $68BA617B $429A693B $693ADA14 $1AD368BB $4B1A617B $681B681B $1A791B $605A4B1A $681B68FB $1A791B $609A4B17 $4B16697A $E013619A $693B68BA $617B1AD3 $681B68FB $1A791B $605A4B10 $681B4B0C $791B681B $4B0D001A $697A609A $619A4B0B $2B00697B $4B0AD005 $182101 $F0004B09 $2300FC47 $46BD0018 $BC80B006 $4708BC02 $3004E50 $203A958 $8019431 $30004B8 +WORD $800D07D $B086B580 $6078AF00 $681B4B30 $4B2F68DA $2140681B $60DA430A $681B4B2C $4B2B68DA $2140681B $60DA438A $681B4B28 $61B7CDB $613B161B $7B5B4B26 $4B260018 $FD36F000 $60FB0003 $7CDB68FB $161B061B $230160BB $68BA617B $429A693B $693ADA14 $1AD368BB $4B1A617B $681B681B $1A791B $605A4B1A $681B68FB $1A791B $609A4B17 $4B16697A $E013619A $693B68BA $617B1AD3 $681B68FB $1A791B $605A4B10 $681B4B0C $791B681B $4B0D001A $697A609A $619A4B0B $2B00697B $4B0AD005 $182101 $F0004B09 $2300FCF7 $46BD0018 $BC80B006 $4708BC02 $3004E50 $203A958 $8019431 $30004B8 POIN HarmAndHealEvent -WORD $800D07D $B082B580 $6078AF00 $18687B $F0004B0A $4B0AFC2B $18681B $F0004B09 $2FC25 $11687B $4B070018 $FC1EF000 $46BD46C0 $BC80B002 $4700BC01 $8034F9D +WORD $800D07D $B082B580 $6078AF00 $18687B $F0004B0A $4B0AFCDB $18681B $F0004B09 $2FCD5 $11687B $4B070018 $FCCEF000 $46BD46C0 $BC80B002 $4700BC01 $8034F9D POIN HealTargetBottomText_Link WORD $800A241 $8035709 $B082B580 $6078AF00 $4B086039 $61B681B $4B070E1A $683B745A $4B05789A $2316735A $46BD0018 $BC80B002 $4708BC02 POIN SacrificeActID_Link @@ -43,20 +45,22 @@ WORD $203A958 $B082B580 $6078AF00 $4B086039 $61B681B $4B070E1A $683B745A $4B0578 POIN ReciprocalAidActID_Link WORD $203A958 $B082B580 $6078AF00 $4B086039 $61B681B $4B070E1A $683B745A $4B05789A $2316735A $46BD0018 $BC80B002 $4708BC02 POIN DrawBackActID_Link -WORD $203A958 $B082B580 $6078AF00 $681B4B08 $4B080018 $FB9EF000 $184B07 $F0004B07 $2307FB99 $46BD0018 $BC80B002 $4708BC02 $3004E50 $8025E7D +WORD $203A958 $B082B580 $6078AF00 $681B4B08 $F0000018 $4B07F911 $4B070018 $FC4AF000 $182307 $B00246BD $BC02BC80 $46C04708 $3004E50 POIN gSacrificeTargetSelection -WORD $804FA3D $B082B580 $6078AF00 $681B4B08 $4B080018 $FB80F000 $184B07 $F0004B07 $2307FB7B $46BD0018 $BC80B002 $4708BC02 $3004E50 $8025E7D +WORD $804FA3D $B082B580 $6078AF00 $681B4B08 $4B080018 $FC32F000 $184B07 $F0004B07 $2307FC2D $46BD0018 $BC80B002 $4708BC02 $3004E50 $8025E7D POIN gArdentSacrificeTargetSelection -WORD $804FA3D $B082B580 $6078AF00 $681B4B08 $F0000018 $4B07F8BD $4B070018 $FB5EF000 $182307 $B00246BD $BC02BC80 $46C04708 $3004E50 +WORD $804FA3D $B082B580 $6078AF00 $681B4B08 $F0000018 $4B07F96F $4B070018 $FC10F000 $182307 $B00246BD $BC02BC80 $46C04708 $3004E50 POIN gReciprocalAidTargetSelection -WORD $804FA3D $B082B580 $6078AF00 $681B4B14 $224068DB $D0014013 $E01A2303 $681A4B10 $681B4B10 $100019 $F0004B0F $1E03FB3B $2303D101 $4B0AE00D $18681B $F0004B0B $4B0BFB31 $FB2EF000 $D0011E03 $E0002301 $182303 $B00246BD $BC02BC80 $46C04708 $3004E50 +WORD $804FA3D $B082B580 $6078AF00 $681B4B18 $61B7CDB $2B01161B $2303DC01 $4B14E022 $68DB681B $40132240 $2303D001 $4B10E01A $4B10681A $19681B $4B0F0010 $FBE4F000 $D1011E03 $E00D2303 $681B4B09 $4B0B0018 $FBDAF000 $F0004B0A $1E03FBD7 $2301D001 $2303E000 $46BD0018 $BC80B002 $4708BC02 $3004E50 POIN ArdentSacrificeID_Link POIN SkillTester -WORD $8025E7D $804FD29 $B082B580 $6078AF00 $681B4B13 $224068DB $D0014013 $E0192303 $681A4B0F $681B4B0F $100019 $F0004B0E $1E03FB03 $2303D101 $4B09E00C $18681B $F854F000 $F0004B09 $1E03FAF7 $2301D001 $2303E000 $46BD0018 $BC80B002 $4708BC02 $3004E50 +WORD $8025E7D $804FD29 $B082B580 $6078AF00 $681B4B13 $224068DB $D0014013 $E0192303 $681A4B0F $681B4B0F $100019 $F0004B0E $1E03FBAD $2303D101 $4B09E00C $18681B $F8FEF000 $F0004B09 $1E03FBA1 $2301D001 $2303E000 $46BD0018 $BC80B002 $4708BC02 $3004E50 POIN ReciprocalAidID_Link POIN SkillTester -WORD $804FD29 $B083B590 $6078AF00 $681B4B19 $61B7ADB $1A161B $7ADB687B $161B061B $100019 $F0004B14 $1E03FAD1 $687BD019 $222068DB $D1164013 $7C1B687B $161B061B $687B0018 $61B7C5B $19161B $7ADB687B $161B061B $E1A061B $4C082300 $FAB7F000 $46C0E002 $46C0E000 $B00346BD $BC01BC90 $46C04700 $2033F3C $8024D8D $804F8BD $B084B580 $6078AF00 $7C1B687B $161B061B $687B60FB $61B7C5B $60BB161B $687A4B0B $4B0B601A $2100681B $4B0A0018 $FA8EF000 $68B94A09 $1868FB $F0004B08 $46C0FA87 $B00446BD $BC01BC80 $46C04700 $2033F3C $202E4E4 $80197E5 -POIN CURRENTOFFSET-211 +WORD $804FD29 $B083B590 $6078AF00 $681B4B22 $61B7ADB $1A161B $7ADB687B $161B061B $100019 $F0004B1D $1E03FB7B $687BD02A $222068DB $D1274013 $2230687B $220F5C9B $61B4013 $D1080E1B $2212687B $687B569A $61B7CDB $429A161B $687BD018 $61B7C1B $18161B $7C5B687B $161B061B $687B0019 $61B7ADB $61B161B $23000E1A $F0004C08 $E004FB50 $E00246C0 $E00046C0 $46BD46C0 $BC90B003 $4700BC01 $2033F3C $8024D8D $804F8BD $B084B580 $6078AF00 $7C1B687B $161B061B $687B60FB $61B7C5B $60BB161B $687A4B0B $4B0B601A $2100681B $4B0A0018 $FB26F000 $68B94A09 $1868FB $F0004B08 $46C0FB1F $B00446BD $BC01BC80 $46C04700 $2033F3C $202E4E4 $80197E5 +POIN CURRENTOFFSET-247 +WORD $8024F71 $B083B590 $6078AF00 $681B4B2E $61B7ADB $1A161B $7ADB687B $161B061B $100019 $F0004B29 $1E03FAFB $687BD040 $222068DB $D13D4013 $681B4B23 $569A2212 $681B4B21 $61B7CDB $429A161B $687BD108 $569A2212 $7CDB687B $161B061B $D02B429A $2212687B $687B569A $61B7CDB $429A161B $687BD109 $569A2212 $681B4B13 $61B7CDB $429A161B $687BDB1A $61B7C1B $18161B $7C5B687B $161B061B $687B0019 $61B7ADB $61B161B $23000E1A $F0004C09 $E006FABA $E00446C0 $E00246C0 $E00046C0 $46BD46C0 $BC90B003 $4700BC01 $2033F3C $8024D8D $804F8BD $B084B580 $6078AF00 $7C1B687B $161B061B $687B60FB $61B7C5B $60BB161B $687A4B0B $4B0B601A $2100681B $4B0A0018 $FA8EF000 $68B94A09 $1868FB $F0004B08 $46C0FA87 $B00446BD $BC01BC80 $46C04700 $2033F3C $202E4E4 $80197E5 +POIN CURRENTOFFSET-295 WORD $8024F71 $B082B580 $2AF00 $701A1DFB $1C0A1DBB $1DFB701A $9DB781B $E1B061B $78121DFA $16120612 $88094916 $21010008 $DC014282 $1C112200 $E12060A $61B4013 $1A0E1B $781B1DBB $61B09DB $40130E1B $78121DBA $16120612 $8849490A $21010008 $DC014282 $1C112200 $E12060A $1E5A4013 $61B4193 $180E1B $B00246BD $BC02BC80 $46C04708 $202E4D4 $B082B580 $6078AF00 $681B4B13 $224068DB $D0014013 $E0192303 $681A4B0F $681B4B0F $100019 $F0004B0E $1E03FA1F $2303D101 $4B09E00C $18681B $F9E0F000 $F0004B09 $1E03FA13 $2301D001 $2303E000 $46BD0018 $BC80B002 $4708BC02 $3004E50 POIN DrawBackID_Link POIN SkillTester diff --git a/Text/skilldesc_text.txt b/Text/skilldesc_text.txt index 8d7d17199d..00c4978750 100644 --- a/Text/skilldesc_text.txt +++ b/Text/skilldesc_text.txt @@ -1635,7 +1635,7 @@ HP to target, but drops user's[N] HP by 10.[X] ## SD_ReciprocalAid -Reciprocal Aid:: User and target[N] +Reciprocal Aid: User and target[N] ally switch their current HP totals.[X]