19 #include "../stru298.h"
37 p_type = PID_TYPE(
pQueue[i].uPackedID);
38 p_id = PID_ID(
pQueue[i].uPackedID);
41 pActors[p_id].uAttributes |= ACTOR_STAND_IN_QUEUE;
74 memcpy(&temp_elem, current_top,
76 memcpy(current_top, test_element,
78 memcpy(test_element, &temp_elem,
93 if (PID_TYPE(
pQueue[i].uPackedID) ==
113 int activ_players[4];
114 int players_recovery_time[4];
134 for (
uint pl_id = 0; pl_id < 4; ++pl_id) {
150 ACTOR_STAND_IN_QUEUE;
171 ->uTimeToRecovery != 0) {
174 [PID_ID(this->
pQueue[k].uPackedID) + 1]
178 activ_players[a_players_count] = k;
193 if (a_players_count > 0) {
194 for (i = 0; i < a_players_count; ++i)
195 players_recovery_time[i] =
198 .GetAttackRecoveryTime(0);
200 for (i = 0; i < a_players_count - 1; ++i) {
201 for (j = i + 1; j < a_players_count; ++j) {
202 if (players_recovery_time[j] <
203 players_recovery_time[i]) {
204 temp = players_recovery_time[i];
205 players_recovery_time[i] = players_recovery_time[j];
206 players_recovery_time[j] = temp;
207 temp = activ_players[i];
208 activ_players[i] = activ_players[j];
209 activ_players[j] = temp;
213 for (i = 0; i < a_players_count; ++i)
214 this->
pQueue[activ_players[i]].actor_initiative = i + 2;
238 objID = PID_ID(
pQueue[i].uPackedID);
240 pPlayers[objID + 1]->uTimeToRecovery =
244 pActors[objID].pMonsterInfo.uRecoveryTime =
273 for (j = 0; j < 22; ++j) {
275 pActors[i].pActorBuffs[j].IsBuffExpiredToTime(
343 int player_num, actor_num, i, j;
347 for (player_num = 0; player_num < 4; ++player_num) {
351 (player_num != PID_ID(
pQueue[j].uPackedID)))
387 (
pQueue[i].actor_initiative > 0))
411 if (
pQueue[0].actor_initiative <= 0)
return;
417 monster_id = PID_ID(
pQueue[i].uPackedID);
426 pActors[monster_id].uCurrentActionTime +=
428 if (
pActors[monster_id].uCurrentActionTime <
429 pActors[monster_id].uCurrentActionLength) {
433 pActors[monster_id].uCurrentActionTime = 0;
434 pActors[monster_id].uCurrentActionLength = 0;
435 pActors[monster_id].UpdateAnimation();
455 monster_id = PID_ID(
pQueue[i].uPackedID);
483 if (
pQueue[0].actor_initiative != 0) {
487 --
pQueue[j].actor_initiative;
490 }
while (
pQueue[0].actor_initiative != 0);
492 if (
pQueue[0].actor_initiative > 0) {
499 if (
pQueue[j].actor_initiative == 0)
504 }
while (
pQueue[0].actor_initiative > 0);
519 v4 = PID_ID(
pQueue[a2].uPackedID);
524 v6 =
pPlayers[v4 + 1]->GetAttackRecoveryTime(0);
526 if (v6 < 30) v6 = 30;
553 int monster_ai_state;
557 if (
pQueue[i].actor_initiative == 0) {
560 monster_ai_state = monster->
uAIState;
578 if (
pQueue[0].actor_initiative <= 0) {
581 (
pQueue[i].actor_initiative > 0))
583 if ((
pQueue[i].uActionLength <= 0) &&
602 unsigned int actor_id;
614 actor_id = PID_ID(
pQueue[queue_index].uPackedID);
618 memcpy(&a4, &a3,
sizeof(a4));
625 if ((
signed int)
pActors[actor_id].uCurrentActionTime >=
626 pActors[actor_id].uCurrentActionLength) {
627 switch (
pActors[actor_id].uAIState) {
629 v19 =
pActors[actor_id].special_ability_use_check(
632 pQueue[queue_index].uPackedID, 5120,
635 pActors[actor_id].vPosition.z +
636 ((
signed int)
pActors[actor_id].uActorHeight >>
646 pActors[actor_id].pMonsterInfo.uMissleAttack1Type,
653 pActors[actor_id].uCurrentActionTime = 0;
654 pActors[actor_id].uCurrentActionLength = 0;
656 pActors[actor_id].UpdateAnimation();
666 pActors[actor_id].pMonsterInfo.uMissleAttack2Type,
675 pActors[actor_id].pMonsterInfo.uSpell1ID, 2,
677 .pMonsterInfo.uSpellSkillAndMastery1);
685 pActors[actor_id].pMonsterInfo.uSpell2ID, 3,
687 .pMonsterInfo.uSpellSkillAndMastery2);
710 unsigned int actor_id;
721 actor_id = PID_ID(
pQueue[queue_index].uPackedID);
730 if (
pActors[actor_id].pMonsterInfo.uHostilityType && !v22)
731 pActors[actor_id].pMonsterInfo.uHostilityType =
747 1][(
pActors[actor_id].pMonsterInfo.uID - 1) / 3 + 1];
752 if ((
double)(
signed int)v9 < 307.2)
753 pActors[actor_id].pMonsterInfo.uHostilityType =
758 pActors[actor_id].pMonsterInfo.uHostilityType =
763 pActors[actor_id].pMonsterInfo.uHostilityType =
768 pActors[actor_id].pMonsterInfo.uHostilityType =
772 if (
pActors[actor_id].pMonsterInfo.uHostilityType == 4 && v22 &&
773 (
signed int)v9 < 5120) {
774 v14 =
pActors[actor_id].special_ability_use_check(actor_id);
778 if (
pActors[actor_id].pMonsterInfo.uMissleAttack2Type) {
785 if (
pActors[actor_id].pMonsterInfo.uSpell1ID) {
792 if (
pActors[actor_id].pMonsterInfo.uSpell2ID) {
799 if (
pActors[actor_id].pMonsterInfo.uMissleAttack1Type) {
806 if ((
double)v9 < 307.2) {
810 pActors[actor_id].uCurrentActionLength;
816 pActors[actor_id].uCurrentActionLength;
824 pActors[actor_id].uCurrentActionLength;
833 unsigned int target_pid;
856 unsigned int target_pid;
878 unsigned int monster_id;
882 monster_id = PID_ID(
pQueue[i].uPackedID);
894 if ((
double)(
signed int)v9.
uDistance < 307.2)
898 pActors[monster_id].uCurrentActionTime +=
900 if (
pActors[monster_id].uCurrentActionTime >
901 pActors[monster_id].uCurrentActionLength) {
903 pActors[monster_id].uCurrentActionTime = 0;
904 pActors[monster_id].uCurrentActionLength = 0;
906 pActors[monster_id].UpdateAnimation();
922 unsigned __int8 pHostileType;
925 unsigned int uActorID;
928 uActorID = PID_ID(
pQueue[queue_position].uPackedID);
936 if (
pActors[uActorID].pMonsterInfo.uHostilityType &&
938 pActors[uActorID].pMonsterInfo.uHostilityType =
945 if (v11 < 0) v11 = 0;
946 pHostileType =
pActors[uActorID].pMonsterInfo.uHostilityType;
947 switch (pHostileType) {
949 if ((
double)v11 < 307.2)
950 pActors[uActorID].pMonsterInfo.uHostilityType =
955 pActors[uActorID].pMonsterInfo.uHostilityType =
960 pActors[uActorID].pMonsterInfo.uHostilityType =
975 pActors[uActorID].uCurrentActionLength;
978 if (
pActors[uActorID].pMonsterInfo.uHostilityType ==
980 if (!(
pActors[uActorID].uAttributes & ACTOR_FLEEING) ||
981 pActors[uActorID].pMonsterInfo.uAIType == 1) {
982 if (
pActors[uActorID].pMonsterInfo.uAIType == 1) {
983 if (
pActors[uActorID].pMonsterInfo.uMovementType ==
992 pActors[uActorID].uCurrentActionLength;
995 if (
pActors[uActorID].pMonsterInfo.uAIType == 2) {
996 if (((
double)
pActors[uActorID].pMonsterInfo.uHP * 0.2) >
997 (
double)
pActors[uActorID].sCurrentHP &&
999 if (
pActors[uActorID].pMonsterInfo.uMovementType ==
1011 pActors[uActorID].uCurrentActionLength;
1015 if (
pActors[uActorID].pMonsterInfo.uAIType == 3) {
1016 if (((
double)
pActors[uActorID].pMonsterInfo.uHP * 0.1) >
1017 (
double)
pActors[uActorID].sCurrentHP &&
1019 if (
pActors[uActorID].pMonsterInfo.uMovementType ==
1031 pActors[uActorID].uCurrentActionLength;
1036 if ((
double)(
signed int)v11 < 307.2)
return 0;
1037 if ((
signed int)v11 < 5120) {
1038 if (
pActors[uActorID].pMonsterInfo.uMissleAttack1Type &&
1039 (
signed int)v11 < 1024)
1042 uActorID, 32, &pDir);
1049 pActors[uActorID].uCurrentActionLength;
1053 switch (
pActors[uActorID].pMonsterInfo.uMovementType) {
1079 pActors[uActorID].uCurrentActionLength;
1089 unsigned int target_pid;
1095 uActorID = PID_ID(
pQueue[i].uPackedID);
1096 curr_acror = &
pActors[uActorID];