mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-06 03:03:38 -05:00
Added nonmatching for AiMovement
This commit is contained in:
parent
7d347d9c77
commit
511f383793
|
|
@ -1,4 +1,23 @@
|
|||
#pragma once
|
||||
.public DTCM_BSS
|
||||
.public EnableIrqFlag
|
||||
.public G3_MultMtx43
|
||||
.public GeomSetTexImageParam
|
||||
.public GeomSetVertexCoord16
|
||||
.public GetAllBaseForms
|
||||
.public GetWindow
|
||||
.public MONSTER_DATA_TABLE_PTR
|
||||
.public MemcpyFast
|
||||
.public MemsetFast
|
||||
.public OS_IRQTable
|
||||
.public RENDER_3D
|
||||
.public RENDER_3D_FUNCTIONS
|
||||
.public Rgb8ToRgb5
|
||||
.public SetIrqFlag
|
||||
.public ShouldMonsterRunAwayAndShowEffect
|
||||
.public TRIG_TABLE
|
||||
.public UpdateWindow
|
||||
.public WINDOW_LIST
|
||||
.public _02099724
|
||||
.public _02099734
|
||||
.public _02099744
|
||||
|
|
@ -10,77 +29,7 @@
|
|||
.public _022A88FC
|
||||
.public _022B966C
|
||||
.public _022B99D0
|
||||
.public AbilityIsActiveVeneer
|
||||
.public abs
|
||||
.public AI_CONFUSED_NO_ATTACK_CHANCE
|
||||
.public AI_REGULAR_ATTACK_WEIGHTS
|
||||
.public AiConsiderMove
|
||||
.public AreMovesEnabled
|
||||
.public CanAiMonsterMoveInDirection
|
||||
.public CanAiUseMove
|
||||
.public CanSeeTarget
|
||||
.public CanTargetEntity
|
||||
.public CanTargetPosition
|
||||
.public CeilFixedPoint
|
||||
.public CheckVariousConditions
|
||||
.public DIRECTIONS_XY
|
||||
.public DTCM_BSS
|
||||
.public DUNGEON_PTR
|
||||
.public DungeonRandInt
|
||||
.public DungeonRandOutcome__022EAB20
|
||||
.public EnableIrqFlag
|
||||
.public EntityIsValid__0230827C
|
||||
.public G3_MultMtx43
|
||||
.public GeomSetTexImageParam
|
||||
.public GeomSetVertexCoord16
|
||||
.public GetAllBaseForms
|
||||
.public GetChebyshevDistance
|
||||
.public GetDirectionTowardsPosition
|
||||
.public GetItemInfo
|
||||
.public GetMoveAiWeight
|
||||
.public GetMoveTypeForMonster
|
||||
.public GetTile
|
||||
.public GetTileAtEntity
|
||||
.public GetTileSafe
|
||||
.public GetTreatmentBetweenMonsters
|
||||
.public GetVisibilityRange
|
||||
.public GetWindow
|
||||
.public HasDropeyeStatus
|
||||
.public InitMove
|
||||
.public IqSkillIsEnabled
|
||||
.public IsBagFull
|
||||
.public IsChargingTwoTurnMove
|
||||
.public IsMonsterCornered
|
||||
.public IsTacticSet
|
||||
.public MemcpyFast
|
||||
.public MemsetFast
|
||||
.public MONSTER_DATA_TABLE_PTR
|
||||
.public MonsterCannotAttack
|
||||
.public OS_IRQTable
|
||||
.public IsPositionWithinTwoTiles
|
||||
.public ov29_022FBDF0
|
||||
.public ov29_022FBE04
|
||||
.public ov29_022FF908
|
||||
.public ov29_02301498
|
||||
.public ShouldAvoidFirstHit
|
||||
.public ov29_02302200
|
||||
.public ov29_023082C4
|
||||
.public ov29_02348D00
|
||||
.public FACING_DIRECTION_INCREMENTS
|
||||
.public ov29_02353530
|
||||
.public RENDER_3D
|
||||
.public RENDER_3D_FUNCTIONS
|
||||
.public Rgb8ToRgb5
|
||||
.public SetActionPassTurnOrWalk
|
||||
.public SetActionRegularAttack
|
||||
.public SetActionStruggle
|
||||
.public SetActionUseMoveAi
|
||||
.public SetActionUseMoveAi
|
||||
.public SetIrqFlag
|
||||
.public SetMonsterActionFields
|
||||
.public ShouldMonsterFollowLeader
|
||||
.public ShouldMonsterHeadToStairs
|
||||
.public ShouldMonsterRunAwayAndShowEffect
|
||||
.public sub_0201BD50
|
||||
.public sub_0201BD80
|
||||
.public sub_0202760C
|
||||
|
|
@ -91,10 +40,3 @@
|
|||
.public sub_0207A324
|
||||
.public sub_02080EF0
|
||||
.public sub_02080F30
|
||||
.public TargetRegularAttack
|
||||
.public TRIG_TABLE
|
||||
.public UpdateAiTargetPos
|
||||
.public UpdateAiTargetPos
|
||||
.public UpdateAiTargetPos
|
||||
.public UpdateWindow
|
||||
.public WINDOW_LIST
|
||||
|
|
|
|||
8
asm/include/itcm_01FFB2C8.inc
Normal file
8
asm/include/itcm_01FFB2C8.inc
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
.public CanAiMonsterMoveInDirection
|
||||
.public DIRECTIONS_XY
|
||||
.public DUNGEON_PTR
|
||||
.public DungeonRandInt
|
||||
.public FACING_DIRECTION_INCREMENTS
|
||||
.public GetTile
|
||||
.public ov29_02301498
|
||||
1328
asm/itcm.s
1328
asm/itcm.s
File diff suppressed because it is too large
Load Diff
280
asm/itcm_01FFB2C8.s
Normal file
280
asm/itcm_01FFB2C8.s
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "itcm_01FFB2C8.inc"
|
||||
|
||||
.section .itcm,4,1,4
|
||||
|
||||
arm_func_start CalculateAiTargetPos
|
||||
CalculateAiTargetPos: ; 0x01FFB2C8
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
|
||||
ldr r1, _01FFB61C ; =DUNGEON_PTR
|
||||
mov sl, r0
|
||||
ldr r0, [r1]
|
||||
ldr sb, [sl, #0xb4]
|
||||
add r0, r0, #0x4000
|
||||
#ifdef JAPAN
|
||||
ldrb r0, [r0, #0x36]
|
||||
#else
|
||||
ldrb r0, [r0, #0xda]
|
||||
#endif
|
||||
ldrb r4, [sl, #0x25]
|
||||
mov r5, #0
|
||||
cmp r0, #0xa5
|
||||
beq _01FFB304
|
||||
cmp r0, #0xaa
|
||||
blo _01FFB31C
|
||||
cmp r0, #0xdc
|
||||
bhs _01FFB31C
|
||||
_01FFB304:
|
||||
ldrsh r0, [sl, #4]
|
||||
ldrsh r1, [sl, #6]
|
||||
bl GetTile
|
||||
ldrh r0, [r0]
|
||||
tst r0, #0x100
|
||||
movne r5, #1
|
||||
_01FFB31C:
|
||||
cmp r5, #0
|
||||
bne _01FFB32C
|
||||
cmp r4, #0xff
|
||||
bne _01FFB3F0
|
||||
_01FFB32C:
|
||||
ldrb r1, [sb, #0x4c]
|
||||
mov r0, sl
|
||||
mov r7, #0
|
||||
add r1, r1, #4
|
||||
and r6, r1, #7
|
||||
bl ov29_02301498
|
||||
cmp r0, #0
|
||||
beq _01FFB35C
|
||||
mov r0, #8
|
||||
bl DungeonRandInt
|
||||
strb r0, [sb, #0x4c]
|
||||
mov r7, #1
|
||||
_01FFB35C:
|
||||
mov r5, #0
|
||||
ldr r4, _01FFB620 ; =FACING_DIRECTION_INCREMENTS
|
||||
add fp, sp, #1
|
||||
b _01FFB3E4
|
||||
_01FFB36C:
|
||||
ldrb r1, [sb, #0x4c]
|
||||
ldr r0, [r4, r5, lsl #2]
|
||||
cmp r7, #0
|
||||
add r0, r1, r0
|
||||
and r8, r0, #7
|
||||
beq _01FFB38C
|
||||
cmp r8, r6
|
||||
beq _01FFB3E0
|
||||
_01FFB38C:
|
||||
mov r0, sl
|
||||
mov r1, r8
|
||||
mov r2, fp
|
||||
bl CanAiMonsterMoveInDirection
|
||||
cmp r0, #0
|
||||
beq _01FFB3E0
|
||||
mov r0, #3
|
||||
strb r0, [sb, #0x7c]
|
||||
ldr r0, _01FFB624 ; =DIRECTIONS_XY
|
||||
mov r3, r8, lsl #2
|
||||
ldrsh r2, [r0, r3]
|
||||
ldrsh r4, [sl, #4]
|
||||
ldr r1, _01FFB628 ; =DIRECTIONS_XY + 2
|
||||
mov r0, #1
|
||||
add r2, r4, r2
|
||||
strh r2, [sb, #0x8c]
|
||||
ldrsh r2, [sl, #6]
|
||||
ldrsh r1, [r1, r3]
|
||||
add r1, r2, r1
|
||||
strh r1, [sb, #0x8e]
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB3E0:
|
||||
add r5, r5, #1
|
||||
_01FFB3E4:
|
||||
cmp r5, #8
|
||||
blt _01FFB36C
|
||||
b _01FFB5D8
|
||||
_01FFB3F0:
|
||||
ldr r0, _01FFB61C ; =DUNGEON_PTR
|
||||
#ifdef JAPAN
|
||||
ldr r1, [sb, #0x11c]
|
||||
ldr r2, [r0]
|
||||
cmp r1, #0
|
||||
add r0, r2, r4, lsl #1
|
||||
add r1, r2, #0x204
|
||||
add r0, r0, #0xf100
|
||||
add r1, r1, #0xf000
|
||||
add r6, r1, r4, lsl #7
|
||||
ldrsh r5, [r0, #0xc4]
|
||||
#else
|
||||
ldr r1, [sb, #0x120]
|
||||
ldr r2, [r0]
|
||||
cmp r1, #0
|
||||
add r0, r2, r4, lsl #1
|
||||
add r1, r2, #0x2a8
|
||||
add r0, r0, #0xf200
|
||||
add r1, r1, #0xf000
|
||||
add r6, r1, r4, lsl #7
|
||||
ldrsh r5, [r0, #0x68]
|
||||
#endif
|
||||
beq _01FFB460
|
||||
mov r0, #8
|
||||
bl DungeonRandInt
|
||||
mov r1, #6
|
||||
strb r1, [sb, #0x7c]
|
||||
mov r3, r0, lsl #2
|
||||
ldr r0, _01FFB624 ; =DIRECTIONS_XY
|
||||
ldrsh r4, [sl, #4]
|
||||
ldrsh r2, [r0, r3]
|
||||
ldr r1, _01FFB628 ; =DIRECTIONS_XY + 2
|
||||
mov r0, #1
|
||||
add r2, r4, r2
|
||||
strh r2, [sb, #0x8c]
|
||||
ldrsh r2, [sl, #6]
|
||||
ldrsh r1, [r1, r3]
|
||||
add r1, r2, r1
|
||||
strh r1, [sb, #0x8e]
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB460:
|
||||
ldrb r0, [sb, #0x7c]
|
||||
cmp r0, #4
|
||||
beq _01FFB520
|
||||
cmp r5, #0
|
||||
bne _01FFB4B8
|
||||
mov r0, #8
|
||||
bl DungeonRandInt
|
||||
mov r1, #6
|
||||
strb r1, [sb, #0x7c]
|
||||
mov r3, r0, lsl #2
|
||||
ldr r0, _01FFB624 ; =DIRECTIONS_XY
|
||||
ldrsh r4, [sl, #4]
|
||||
ldrsh r2, [r0, r3]
|
||||
ldr r1, _01FFB628 ; =DIRECTIONS_XY + 2
|
||||
mov r0, #1
|
||||
add r2, r4, r2
|
||||
strh r2, [sb, #0x8c]
|
||||
ldrsh r2, [sl, #6]
|
||||
ldrsh r1, [r1, r3]
|
||||
add r1, r2, r1
|
||||
strh r1, [sb, #0x8e]
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB4B8:
|
||||
mov r4, #0
|
||||
b _01FFB518
|
||||
_01FFB4C0:
|
||||
mov r0, r5
|
||||
bl DungeonRandInt
|
||||
mov r2, r0, lsl #2
|
||||
ldrsh r3, [sl, #4]
|
||||
ldrsh r1, [r6, r2]
|
||||
cmp r3, r1
|
||||
addeq r1, r6, r2
|
||||
ldreqsh r2, [sl, #6]
|
||||
ldreqsh r1, [r1, #2]
|
||||
cmpeq r2, r1
|
||||
beq _01FFB514
|
||||
mov r1, #4
|
||||
strb r1, [sb, #0x7c]
|
||||
mov r1, r0, lsl #2
|
||||
ldrsh r2, [r6, r1]
|
||||
add r1, r6, r0, lsl #2
|
||||
mov r0, #1
|
||||
strh r2, [sb, #0x8c]
|
||||
ldrsh r1, [r1, #2]
|
||||
strh r1, [sb, #0x8e]
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB514:
|
||||
add r4, r4, #1
|
||||
_01FFB518:
|
||||
cmp r4, #0xa
|
||||
blt _01FFB4C0
|
||||
_01FFB520:
|
||||
ldrsh r0, [sl, #4]
|
||||
ldrsh r1, [sl, #6]
|
||||
bl GetTile
|
||||
ldrh r0, [r0]
|
||||
tst r0, #8
|
||||
beq _01FFB5D0
|
||||
mov r0, #8
|
||||
bl DungeonRandInt
|
||||
mov r8, r0
|
||||
mov r5, #0
|
||||
add fp, sp, #0
|
||||
ldr r4, _01FFB624 ; =DIRECTIONS_XY
|
||||
b _01FFB5C8
|
||||
_01FFB554:
|
||||
and r8, r8, #7
|
||||
mov r1, r8, lsl #2
|
||||
add r0, r4, r8, lsl #2
|
||||
ldrsh r6, [sl, #4]
|
||||
ldrsh r3, [r4, r1]
|
||||
ldrsh r2, [sl, #6]
|
||||
ldrsh r1, [r0, #2]
|
||||
add r6, r6, r3
|
||||
mov r0, r6
|
||||
add r7, r2, r1
|
||||
mov r1, r7
|
||||
bl GetTile
|
||||
ldrb r0, [r0, #7]
|
||||
cmp r0, #0xff
|
||||
bne _01FFB5C0
|
||||
mov r0, sl
|
||||
mov r1, r8
|
||||
mov r2, fp
|
||||
bl CanAiMonsterMoveInDirection
|
||||
cmp r0, #0
|
||||
beq _01FFB5C0
|
||||
mov r0, #3
|
||||
strb r0, [sb, #0x7c]
|
||||
strh r6, [sb, #0x8c]
|
||||
strh r7, [sb, #0x8e]
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB5C0:
|
||||
add r5, r5, #1
|
||||
add r8, r8, #1
|
||||
_01FFB5C8:
|
||||
cmp r5, #8
|
||||
blt _01FFB554
|
||||
_01FFB5D0:
|
||||
mov r0, #1
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
_01FFB5D8:
|
||||
mov r0, #8
|
||||
bl DungeonRandInt
|
||||
mov r1, #6
|
||||
strb r1, [sb, #0x7c]
|
||||
mov r3, r0, lsl #2
|
||||
ldr r0, _01FFB624 ; =DIRECTIONS_XY
|
||||
ldrsh r4, [sl, #4]
|
||||
ldrsh r2, [r0, r3]
|
||||
ldr r1, _01FFB628 ; =DIRECTIONS_XY + 2
|
||||
mov r0, #1
|
||||
add r2, r4, r2
|
||||
strh r2, [sb, #0x8c]
|
||||
ldrsh r2, [sl, #6]
|
||||
ldrsh r1, [r1, r3]
|
||||
add r1, r2, r1
|
||||
strh r1, [sb, #0x8e]
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
|
||||
.align 2, 0
|
||||
_01FFB61C: .word DUNGEON_PTR
|
||||
_01FFB620: .word FACING_DIRECTION_INCREMENTS
|
||||
_01FFB624: .word DIRECTIONS_XY
|
||||
_01FFB628: .word DIRECTIONS_XY + 2
|
||||
arm_func_end CalculateAiTargetPos
|
||||
|
||||
arm_func_start sub_01FFB62C
|
||||
sub_01FFB62C: ; 0x01FFB62C
|
||||
ldr r3, [r0, #0xb4]
|
||||
mov r2, #0
|
||||
strb r2, [r3, #0x7c]
|
||||
ldrh r1, [r0, #4]
|
||||
strh r1, [r3, #0x8c]
|
||||
ldrh r0, [r0, #6]
|
||||
strh r0, [r3, #0x8e]
|
||||
str r2, [r3, #0x84]
|
||||
strh r2, [r3, #0x80]
|
||||
bx lr
|
||||
arm_func_end sub_01FFB62C
|
||||
|
||||
.global _01FFB654
|
||||
_01FFB654:
|
||||
.byte 0x05, 0x03, 0x00, 0x00
|
||||
|
|
@ -26,8 +26,8 @@ _022FF8EC:
|
|||
arm_func_end GetMobilityTypeAfterIqSkills
|
||||
#endif
|
||||
|
||||
arm_func_start ov29_022FF908
|
||||
ov29_022FF908: ; 0x022FF908
|
||||
arm_func_start CanCrossWalls
|
||||
CanCrossWalls: ; 0x022FF908
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
ldr r4, [r5, #0xb4]
|
||||
|
|
@ -48,7 +48,7 @@ ov29_022FF908: ; 0x022FF908
|
|||
movne r0, #0
|
||||
and r0, r0, #0xff
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end ov29_022FF908
|
||||
arm_func_end CanCrossWalls
|
||||
|
||||
arm_func_start ov29_022FF958
|
||||
ov29_022FF958: ; 0x022FF958
|
||||
|
|
|
|||
|
|
@ -175,8 +175,8 @@ ov29_023021F0: ; 0x023021F0
|
|||
_023021FC: .word UpdateIqSkills
|
||||
arm_func_end ov29_023021F0
|
||||
|
||||
arm_func_start ov29_02302200
|
||||
ov29_02302200: ; 0x02302200
|
||||
arm_func_start CanSeeTeammate
|
||||
CanSeeTeammate: ; 0x02302200
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
mov r4, r0
|
||||
ldr r0, [r4, #0xb4]
|
||||
|
|
@ -216,4 +216,4 @@ _02302268:
|
|||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_02302278: .word DUNGEON_PTR
|
||||
arm_func_end ov29_02302200
|
||||
arm_func_end CanSeeTeammate
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ ShouldMonsterFollowLeader: ; 0x023082A0
|
|||
ldmia sp!, {r3, pc}
|
||||
arm_func_end ShouldMonsterFollowLeader
|
||||
|
||||
arm_func_start ov29_023082C4
|
||||
ov29_023082C4: ; 0x023082C4
|
||||
arm_func_start GetLeaderIfVisible
|
||||
GetLeaderIfVisible: ; 0x023082C4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
ldr r0, [r5, #0xb4]
|
||||
|
|
@ -50,4 +50,4 @@ ov29_023082C4: ; 0x023082C4
|
|||
_02308338:
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end ov29_023082C4
|
||||
arm_func_end GetLeaderIfVisible
|
||||
|
|
|
|||
8
include/dungeon_ai_movement.h
Normal file
8
include/dungeon_ai_movement.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef PMDSKY_DUNGEON_AI_MOVEMENT_H
|
||||
#define PMDSKY_DUNGEON_AI_MOVEMENT_H
|
||||
|
||||
#include "dungeon_mode.h"
|
||||
|
||||
void AiMovement(struct entity *monster, bool8 show_run_away_effect);
|
||||
|
||||
#endif //PMDSKY_DUNGEON_AI_MOVEMENT_H
|
||||
|
|
@ -16,9 +16,12 @@
|
|||
#define DEFAULT_STAT_STAGE 10
|
||||
#define MAX_STAT_STAGE 20
|
||||
#define MAX_SPEED_STAGE 4
|
||||
#define MAX_HP_LIMIT 999
|
||||
|
||||
#define NUM_SPEED_COUNTERS 5
|
||||
#define MAX_STOCKPILE_STAGE 3
|
||||
#define NUM_STATS_PER_CATEGORY 2
|
||||
#define NUM_PREV_POS 4
|
||||
|
||||
#define STAT_STAGE_ATK 0
|
||||
#define STAT_STAGE_SP_ATK 1
|
||||
|
|
@ -290,10 +293,7 @@ struct monster {
|
|||
// in order to update the camera and minimap. Changed to held_item.id after checking.
|
||||
enum item_id previous_held_item_id;
|
||||
// Previous position data is used by the AI
|
||||
struct position prev_pos; // 0x6A: Position 1 turn ago
|
||||
struct position prev_pos2; // 0x6E: Position 2 turns ago
|
||||
struct position prev_pos3; // 0x72: Position 3 turns ago
|
||||
struct position prev_pos4; // 0x76: Position 4 turns ago
|
||||
struct position prev_pos[NUM_PREV_POS]; // 0x6A: Position X turns ago
|
||||
struct ai_target ai_target; // 0x7A
|
||||
// 0x90: Work array while updating skills in the menu. Same meaning as iq_skill_flags.
|
||||
struct iq_skill_flags iq_skill_menu_flags;
|
||||
|
|
@ -321,7 +321,7 @@ struct monster {
|
|||
u32 wrap_pair_unique_id;
|
||||
// 0xB8: Tracks the damage taken to deal when bide status ends. Max 0x3E7 (999).
|
||||
u32 bide_damage_tally;
|
||||
enum monster_behavior monster_behavior : 8; // 0xBC
|
||||
enum monster_behavior monster_behavior; // 0xBC
|
||||
struct sleep_class_status sleep_class_status; // 0xBD
|
||||
struct burn_class_status burn_class_status; // 0xBF
|
||||
struct frozen_class_status frozen_class_status; // 0xC4
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef PMDSKY_MATH_H
|
||||
#define PMDSKY_MATH_H
|
||||
|
||||
#define INFINITY 999
|
||||
#define INFINITY_2 999999
|
||||
|
||||
#define F248LessThanFloat(x, y) (x < (int)(y * 0x100))
|
||||
#define F248LessThanInt(x, y) (x < 0x100 * y)
|
||||
|
||||
|
|
|
|||
2
main.lsf
2
main.lsf
|
|
@ -142,6 +142,8 @@ Autoload ITCM
|
|||
{
|
||||
Address 0x01FF8000
|
||||
Object asm/itcm.o (.itcm)
|
||||
Object src/dungeon_ai_movement.o (.itcm)
|
||||
Object asm/itcm_01FFB2C8.o (.itcm)
|
||||
Object src/dungeon_ai_itcm.o (.itcm)
|
||||
Object asm/itcm_01FFBD20.o (.itcm)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ u32 AiConsiderMove(struct ai_possible_move *ai_possible_move, struct entity *mon
|
|||
|
||||
if (GetMoveTargetAndRange(move, FALSE) == TARGET_USER | RANGE_USER | AI_CONDITION_HP_25)
|
||||
{
|
||||
s32 max_hp = MIN(pokemon_info->max_hp_stat + pokemon_info->max_hp_boost, 999);
|
||||
s32 max_hp = MIN(pokemon_info->max_hp_stat + pokemon_info->max_hp_boost, MAX_HP_LIMIT);
|
||||
if (pokemon_info->hp == max_hp)
|
||||
return move_weight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
#include "overlay_29_022EBC50.h"
|
||||
#include "overlay_29_02338350.h"
|
||||
|
||||
#define REGULAR_ATTACK_INDEX 4
|
||||
|
||||
#ifdef SDK_ARM9
|
||||
#include <nitro/itcm_begin.h>
|
||||
#endif //SDK_ARM9
|
||||
|
||||
#define REGULAR_ATTACK_INDEX 4
|
||||
|
||||
// https://decomp.me/scratch/zg7V6
|
||||
#ifdef NONMATCHING
|
||||
void ChooseAiMove(struct entity *monster)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ u32 GetAiUseItemProbability(struct entity *item_consumer, struct item *item, u32
|
|||
case ITEM_ORAN_BERRY:
|
||||
case ITEM_SITRUS_BERRY:
|
||||
s32 pokemon_max_hp = pokemon_info->max_hp_stat + pokemon_info->max_hp_boost;
|
||||
if (pokemon_info->hp < Min(999, pokemon_max_hp) && pokemon_info->hp <= Min(999, pokemon_max_hp) / 4)
|
||||
if (pokemon_info->hp < Min(MAX_HP_LIMIT, pokemon_max_hp) && pokemon_info->hp <= Min(MAX_HP_LIMIT, pokemon_max_hp) / 4)
|
||||
{
|
||||
if (!target_other)
|
||||
if (IsAdjacentToEnemy(item_consumer))
|
||||
|
|
@ -203,7 +203,7 @@ u32 GetAiUseItemProbability(struct entity *item_consumer, struct item *item, u32
|
|||
else
|
||||
{
|
||||
s32 pokemon_max_hp = pokemon_info->max_hp_stat + pokemon_info->max_hp_boost;
|
||||
if (pokemon_info->hp < Min(999, pokemon_max_hp) && pokemon_info->hp < 20)
|
||||
if (pokemon_info->hp < Min(MAX_HP_LIMIT, pokemon_max_hp) && pokemon_info->hp < 20)
|
||||
{
|
||||
if (!target_other)
|
||||
if (IsAdjacentToEnemy(item_consumer))
|
||||
|
|
|
|||
1693
src/dungeon_ai_movement.c
Normal file
1693
src/dungeon_ai_movement.c
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -21,8 +21,8 @@ bool8 ShouldMonsterRunAway(struct entity *monster)
|
|||
if (AbilityIsActive(monster, ABILITY_RUN_AWAY))
|
||||
{
|
||||
s32 max_hp = pokemon_info->max_hp_stat + pokemon_info->max_hp_boost;
|
||||
if (max_hp > 999)
|
||||
max_hp = 999;
|
||||
if (max_hp > MAX_HP_LIMIT)
|
||||
max_hp = MAX_HP_LIMIT;
|
||||
|
||||
bool8 run_away_active = pokemon_info->hp < max_hp / 2;
|
||||
if (run_away_active)
|
||||
|
|
@ -35,8 +35,8 @@ bool8 ShouldMonsterRunAway(struct entity *monster)
|
|||
if (IsTacticSet(monster, TACTIC_AVOID_TROUBLE))
|
||||
{
|
||||
s32 max_hp = pokemon_info->max_hp_stat + pokemon_info->max_hp_boost;
|
||||
if (max_hp > 999)
|
||||
max_hp = 999;
|
||||
if (max_hp > MAX_HP_LIMIT)
|
||||
max_hp = MAX_HP_LIMIT;
|
||||
|
||||
if (pokemon_info->hp <= max_hp / 2)
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ bool8 MonsterHasQuarterHp(struct entity *monster)
|
|||
{
|
||||
struct monster *entity_data = GetEntInfo(monster);
|
||||
s32 max_hp = entity_data->max_hp_stat + entity_data->max_hp_boost;
|
||||
if (max_hp > 999)
|
||||
max_hp = 999;
|
||||
if (max_hp > MAX_HP_LIMIT)
|
||||
max_hp = MAX_HP_LIMIT;
|
||||
|
||||
if (entity_data->hp <= max_hp / 4)
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -84,28 +84,28 @@ s32 WeightWeakTypePicker(struct entity *user, struct entity *target, enum type_i
|
|||
|
||||
if (move_type == TYPE_WATER && AbilityIsActiveVeneer(user, ABILITY_TORRENT))
|
||||
{
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, 999);
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, MAX_HP_LIMIT);
|
||||
if (max_hp_stat / 4 >= user_data->hp)
|
||||
weight *= 2;
|
||||
}
|
||||
|
||||
if (move_type == TYPE_GRASS && AbilityIsActiveVeneer(user, ABILITY_OVERGROW))
|
||||
{
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, 999);
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, MAX_HP_LIMIT);
|
||||
if (max_hp_stat / 4 >= user_data->hp)
|
||||
weight *= 2;
|
||||
}
|
||||
|
||||
if (move_type == TYPE_BUG && AbilityIsActiveVeneer(user, ABILITY_SWARM))
|
||||
{
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, 999);
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, MAX_HP_LIMIT);
|
||||
if (max_hp_stat / 4 >= user_data->hp)
|
||||
weight *= 2;
|
||||
}
|
||||
|
||||
if (move_type == TYPE_FIRE && AbilityIsActiveVeneer(user, ABILITY_BLAZE))
|
||||
{
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, 999);
|
||||
s32 max_hp_stat = MIN(user_data->max_hp_stat + user_data->max_hp_boost, MAX_HP_LIMIT);
|
||||
if (max_hp_stat / 4 >= user_data->hp)
|
||||
weight *= 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ bool8 HasLowHealth(struct entity *entity)
|
|||
|
||||
struct monster *pokemon_info = GetEntInfo(entity);
|
||||
s32 max_hp = pokemon_info->max_hp_stat + pokemon_info->max_hp_boost;
|
||||
if (max_hp > 999)
|
||||
max_hp = 999;
|
||||
if (max_hp > MAX_HP_LIMIT)
|
||||
max_hp = MAX_HP_LIMIT;
|
||||
|
||||
return pokemon_info->hp < max_hp / 4;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
#include "dungeon_recruitment.h"
|
||||
#include "dungeon.h"
|
||||
#include "dungeon_mode.h"
|
||||
#include "dungeon_logic_3.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "main_0208655C.h"
|
||||
#include "enums.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "dg_random.h"
|
||||
#include "dungeon_logic_3.h"
|
||||
#include "dungeon_mode.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_visibility.h"
|
||||
#include "dungeon.h"
|
||||
#include "enums.h"
|
||||
#include "main_0205283C.h" // GetRecruitRate1 and GetRecruitRate2
|
||||
#include "main_0208655C.h"
|
||||
#include "math.h"
|
||||
#include "overlay_29_0230E578.h" // ItemIsActive__0230E578
|
||||
|
||||
extern bool8 IsRecruitingAllowed(u8 dungeon_id);
|
||||
|
|
@ -36,7 +37,7 @@ extern const s16 SKY_MELODICA_RECRUIT_BOOST;
|
|||
|
||||
extern s16 RECRUITMENT_LEVEL_BOOST_TABLE[];
|
||||
|
||||
bool8 SpecificRecruitCheck(u32 monster_id)
|
||||
bool8 SpecificRecruitCheck(u32 monster_id)
|
||||
{
|
||||
if (DUNGEON_PTR[0]->recruiting_enabled == FALSE) {
|
||||
return FALSE;
|
||||
|
|
@ -83,19 +84,19 @@ bool8 SpecificRecruitCheck(u32 monster_id)
|
|||
}
|
||||
}
|
||||
|
||||
bool8 RecruitCheck(struct entity* leader, struct entity* target)
|
||||
bool8 RecruitCheck(struct entity* leader, struct entity* target)
|
||||
{
|
||||
s32 random_roll;
|
||||
struct monster* leader_monster_info = leader->info;
|
||||
struct monster* target_monster_info = target->info;
|
||||
|
||||
|
||||
s32 recruit_rate;
|
||||
bool8 already_on_team;
|
||||
s16 target_mon_id;
|
||||
|
||||
if (!IsRecruitingAllowed(DUNGEON_PTR[0]->id) ||
|
||||
IsFullFloorFixedRoom() ||
|
||||
IsLegendaryChallengeFloor() ||
|
||||
if (!IsRecruitingAllowed(DUNGEON_PTR[0]->id) ||
|
||||
IsFullFloorFixedRoom() ||
|
||||
IsLegendaryChallengeFloor() ||
|
||||
IsCurrentMissionTypeExact(MISSION_ARREST_OUTLAW, MISSION_OUTLAW_HIDEOUT))
|
||||
return FALSE;
|
||||
|
||||
|
|
@ -116,7 +117,7 @@ bool8 RecruitCheck(struct entity* leader, struct entity* target)
|
|||
|| target_mon_id == MONSTER_LATIAS || target_mon_id == MONSTER_LATIOS
|
||||
|| target_mon_id == MONSTER_JIRACHI || target_mon_id == MONSTER_RAYQUAZA
|
||||
|| target_mon_id == MONSTER_DEOXYS_NORMAL || target_mon_id == MONSTER_REGIROCK
|
||||
|| target_mon_id == MONSTER_REGICE || target_mon_id == MONSTER_REGISTEEL
|
||||
|| target_mon_id == MONSTER_REGICE || target_mon_id == MONSTER_REGISTEEL
|
||||
|| (u16)(s16)(target_mon_id - 534) <= 1) {
|
||||
if (IsMonsterOnTeam(target_mon_id, 1))
|
||||
return FALSE;
|
||||
|
|
@ -156,9 +157,9 @@ bool8 RecruitCheck(struct entity* leader, struct entity* target)
|
|||
recruit_rate = recruit_rate >>= 1;
|
||||
}
|
||||
|
||||
if (recruit_rate == -999)
|
||||
if (recruit_rate == -INFINITY)
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (ItemIsActive__0230E578(leader, ITEM_FRIEND_BOW)) {
|
||||
recruit_rate += FRIEND_BOW_FAST_FRIEND_BOOST;
|
||||
} else if (ItemIsActive__0230E578(leader, ITEM_GOLDEN_MASK)) {
|
||||
|
|
@ -189,16 +190,16 @@ bool8 RecruitCheck(struct entity* leader, struct entity* target)
|
|||
|
||||
if (random_roll >= recruit_rate)
|
||||
return FALSE;
|
||||
|
||||
|
||||
s32 free_slot_index = GetFirstEmptyMemberIdx(0);
|
||||
|
||||
if(free_slot_index < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if(free_slot_index >= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,14 +114,14 @@ bool8 StatusCheckerCheck(struct entity *attacker, struct move *move)
|
|||
if (pokemon_info->frozen_class_status.freeze == STATUS_FROZEN_INGRAIN)
|
||||
return FALSE;
|
||||
|
||||
s32 max_hp = Min(999, pokemon_info->max_hp_stat + pokemon_info->max_hp_boost);
|
||||
s32 max_hp = Min(MAX_HP_LIMIT, pokemon_info->max_hp_stat + pokemon_info->max_hp_boost);
|
||||
if (max_hp / 2 < pokemon_info->hp)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
case MOVE_SWALLOW:
|
||||
{
|
||||
s32 max_hp = Min(999, pokemon_info->max_hp_stat + pokemon_info->max_hp_boost);
|
||||
s32 max_hp = Min(MAX_HP_LIMIT, pokemon_info->max_hp_stat + pokemon_info->max_hp_boost);
|
||||
if (max_hp <= pokemon_info->hp || pokemon_info->stockpile_stage == 0)
|
||||
return FALSE;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user