Mercurial > mm7
comparison mm7_5.cpp @ 2059:f9698295c0bd
AttackerInfo, MerchandiseTest
author | Ritor1 |
---|---|
date | Sun, 01 Dec 2013 23:43:03 +0600 |
parents | b7485a6502f2 |
children | 259df09dfb50 |
comparison
equal
deleted
inserted
replaced
2058:e249bd483311 | 2059:f9698295c0bd |
---|---|
53 } | 53 } |
54 | 54 |
55 //----- (00438F8F) -------------------------------------------------------- | 55 //----- (00438F8F) -------------------------------------------------------- |
56 void area_of_effect__damage_evaluate() | 56 void area_of_effect__damage_evaluate() |
57 { | 57 { |
58 int v2; // ecx@3 | 58 int attacker_type; // ecx@3 |
59 signed int v3; // eax@3 | 59 signed int v3; // eax@3 |
60 unsigned int victim_id; // edi@6 | 60 unsigned int target_id; // edi@6 |
61 int victim_type; // eax@6 | 61 int target_type; // eax@6 |
62 int v10; // edi@8 | 62 int v10; // edi@8 |
63 Vec3_int_ agressor_coord; // ST04_12@9 | 63 Vec3_int_ attacker_coord; // ST04_12@9 |
64 int v12; // ST0C_4@10 | 64 int v12; // ST0C_4@10 |
65 int v15; // edx@15 | 65 int v15; // edx@15 |
66 int v19; // edi@15 | 66 int v19; // edi@15 |
67 int v23; // edx@18 | 67 int v23; // edx@18 |
68 int v24; // eax@18 | 68 int v24; // eax@18 |
69 int v30; // eax@29 | 69 int v30; // eax@29 |
70 int v31; // edx@29 | 70 int v31; // edx@29 |
71 int v32; // eax@29 | 71 int v32; // eax@29 |
72 int v33; // ST24_4@29 | 72 int v33; // ST24_4@29 |
73 SpriteObject *v36; // [sp+0h] [bp-28h]@0 | 73 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
74 int agressor_id; // [sp+10h] [bp-18h]@1 | 74 int attacker_id; // [sp+10h] [bp-18h]@1 |
75 int v44; // [sp+14h] [bp-14h]@15 | 75 int v44; // [sp+14h] [bp-14h]@15 |
76 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | 76 //Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 |
77 int a1; // [sp+20h] [bp-8h]@8 | 77 int a1; // [sp+20h] [bp-8h]@8 |
78 int v48; // [sp+24h] [bp-4h]@8 | 78 int v48; // [sp+24h] [bp-4h]@8 |
79 | 79 |
80 if ( AgressorAtackInfo.count > 0 ) | 80 |
81 { | 81 for ( attacker_id = 0; attacker_id < AttackerInfo.count; ++attacker_id ) |
82 pVelocity = &AgressorAtackInfo.vec_4B4; | 82 { |
83 for ( agressor_id = 0; agressor_id < AgressorAtackInfo.count; ++agressor_id ) | 83 attacker_type = PID_TYPE(AttackerInfo.pIDs[attacker_id]); |
84 { | 84 v3 = PID_ID(AttackerInfo.pIDs[attacker_id]); |
85 v2 = PID_TYPE(AgressorAtackInfo.pIDs[agressor_id]); | 85 |
86 v3 = PID_ID(AgressorAtackInfo.pIDs[agressor_id]); | 86 if ( attacker_type == 2 ) |
87 | 87 { |
88 if ( v2 == 2 ) | 88 v36 = &pSpriteObjects[v3]; |
89 attacker_type = PID_TYPE(pSpriteObjects[v3].spell_caster_pid); | |
90 v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid); | |
91 } | |
92 | |
93 if ( AttackerInfo.field_3EC[attacker_id] & 1 ) | |
94 { | |
95 target_id = PID_ID(ai_near_actors_targets_pid[v3]); | |
96 target_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3; | |
97 if ( target_type ) | |
89 { | 98 { |
90 v36 = &pSpriteObjects[v3]; | 99 if ( target_type == 1 )//party damage from monsters(повреждения группе от монстров) |
91 v2 = PID_TYPE(pSpriteObjects[v3].spell_caster_pid); | |
92 v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid); | |
93 } | |
94 | |
95 if ( AgressorAtackInfo.field_3EC[agressor_id] & 1 ) | |
96 { | |
97 victim_id = PID_ID(ai_near_actors_targets_pid[v3]); | |
98 victim_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3; | |
99 if ( victim_type ) | |
100 { | 100 { |
101 if ( victim_type == 1 )//party damage from monsters(повреждения группе от монстров) | 101 v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; |
102 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id]; | |
103 v48 = v10; | |
104 if ( a1 * a1 + v10 * v10 | |
105 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id])) | |
106 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id])) | |
107 < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) ) | |
102 { | 108 { |
103 v10 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; | 109 attacker_coord.x = AttackerInfo.pXs[attacker_id]; |
104 a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; | 110 attacker_coord.y = AttackerInfo.pYs[attacker_id]; |
105 v48 = v10; | 111 attacker_coord.z = AttackerInfo.pZs[attacker_id]; |
106 if ( a1 * a1 + v10 * v10 | 112 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) ) |
107 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) | 113 DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], stru_50C198.which_player_to_attack(&pActors[v3])); |
108 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) | |
109 < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) ) | |
110 { | |
111 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; | |
112 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; | |
113 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; | |
114 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) | |
115 DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, stru_50C198.which_player_to_attack(&pActors[v3])); | |
116 } | |
117 } | 114 } |
118 } | 115 } |
119 else//Actor damage from monsters(повреждение местного жителя) | 116 } |
117 else//Actor damage from monsters(повреждение местного жителя) | |
118 { | |
119 if ( SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 | |
120 || SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 | |
121 && LODWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) | |
122 || pActors[target_id].CanAct() ) | |
120 { | 123 { |
121 if ( SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 | 124 v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id]; |
122 || SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 | 125 a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id]; |
123 && LODWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) | 126 v44 = pActors[target_id].vPosition.z; |
124 || pActors[victim_id].CanAct() ) | 127 v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius; |
128 v48 = v15; | |
129 if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) | |
130 * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) ) | |
125 { | 131 { |
126 v15 = pActors[victim_id].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; | 132 attacker_coord.x = AttackerInfo.pXs[attacker_id]; |
127 a1 = pActors[victim_id].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; | 133 attacker_coord.y = AttackerInfo.pYs[attacker_id]; |
128 v44 = pActors[victim_id].vPosition.z; | 134 attacker_coord.z = AttackerInfo.pZs[attacker_id]; |
129 v19 = AgressorAtackInfo.pYs[agressor_id] + pActors[victim_id].uActorRadius; | 135 if ( sub_407A1C(pActors[target_id].vPosition.x, pActors[target_id].vPosition.y, pActors[target_id].vPosition.z + 50, attacker_coord) ) |
130 v48 = v15; | |
131 if ( a1 * a1 + v15 * v15 + (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]) | |
132 * (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]) < (unsigned int)(v19 * v19) ) | |
133 { | 136 { |
134 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; | 137 Vec3_int_::Normalize(&a1, &v48, &v44); |
135 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; | 138 AttackerInfo.vec_4B4[attacker_id].x = a1; |
136 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; | 139 AttackerInfo.vec_4B4[attacker_id].y = v48; |
137 if ( sub_407A1C(pActors[victim_id].vPosition.x, pActors[victim_id].vPosition.y, pActors[victim_id].vPosition.z + 50, agressor_coord) ) | 140 AttackerInfo.vec_4B4[attacker_id].z = v44; |
138 { | 141 ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]); |
139 Vec3_int_::Normalize(&a1, &v48, &v44); | |
140 pVelocity->x = a1; | |
141 pVelocity->y = v48; | |
142 pVelocity->z = v44; | |
143 ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], victim_id, pVelocity, AgressorAtackInfo.field_450[agressor_id]); | |
144 } | |
145 } | 142 } |
146 } | 143 } |
147 } | 144 } |
148 } | 145 } |
149 else //damage from spells(повреждения от заклов(метеоритный дождь)) | 146 } |
150 { | 147 else //damage from spells(повреждения от заклов(метеоритный дождь)) |
151 v23 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; | 148 { |
152 v24 = ((signed int)pParty->uPartyHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; | 149 v23 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; |
153 a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; | 150 v24 = ((signed int)pParty->uPartyHeight >> 1) - AttackerInfo.pZs[attacker_id]; |
154 v48 = v23; | 151 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id]; |
155 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) ) | 152 v48 = v23; |
156 {//party damage (повреждения группе) | 153 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) ) |
157 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; | 154 {//party damage (повреждения группе) |
158 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; | 155 attacker_coord.x = AttackerInfo.pXs[attacker_id]; |
159 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; | 156 attacker_coord.y = AttackerInfo.pYs[attacker_id]; |
160 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) | 157 attacker_coord.z = AttackerInfo.pZs[attacker_id]; |
158 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) ) | |
159 { | |
160 for ( uint i = 0; i < 4; ++i ) | |
161 { | 161 { |
162 for ( uint i = 0; i < 4; ++i ) | 162 if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead])) |
163 { | 163 && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] ) |
164 if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead])) | 164 DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], i); |
165 && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] ) | |
166 DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, i); | |
167 } | |
168 } | 165 } |
169 } | 166 } |
170 if ( (signed int)uNumActors > 0 ) | 167 } |
171 {//actors damage(повреждения другим участникам) | 168 if ( (signed int)uNumActors > 0 ) |
172 for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID ) | 169 {//actors damage(повреждения другим участникам) |
170 for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID ) | |
171 { | |
172 if ( pActors[actorID].CanAct() ) | |
173 { | 173 { |
174 if ( pActors[actorID].CanAct() ) | 174 v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id]; |
175 a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id]; | |
176 v31 = pActors[actorID].vPosition.z; | |
177 v48 = v30; | |
178 v44 = pActors[actorID].vPosition.z; | |
179 v32 = (pActors[actorID].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]; | |
180 v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id]; | |
181 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) | |
175 { | 182 { |
176 v30 = pActors[actorID].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; | 183 attacker_coord.x = AttackerInfo.pXs[attacker_id]; |
177 a1 = pActors[actorID].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; | 184 attacker_coord.y = AttackerInfo.pYs[attacker_id]; |
178 v31 = pActors[actorID].vPosition.z; | 185 attacker_coord.z = AttackerInfo.pZs[attacker_id]; |
179 v48 = v30; | 186 if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) ) |
180 v44 = pActors[actorID].vPosition.z; | |
181 v32 = (pActors[actorID].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; | |
182 v33 = pActors[actorID].uActorRadius + AgressorAtackInfo.pYs[agressor_id]; | |
183 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) | |
184 { | 187 { |
185 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; | 188 Vec3_int_::Normalize(&a1, &v48, &v44); |
186 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; | 189 AttackerInfo.vec_4B4[attacker_id].x = a1; |
187 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; | 190 AttackerInfo.vec_4B4[attacker_id].y = v48; |
188 if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, agressor_coord) ) | 191 AttackerInfo.vec_4B4[attacker_id].z = v44; |
192 switch ( attacker_type ) | |
189 { | 193 { |
190 Vec3_int_::Normalize(&a1, &v48, &v44); | 194 case OBJECT_Player: |
191 pVelocity->x = a1; | 195 DamageMonsterFromParty(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]); |
192 pVelocity->y = v48; | 196 break; |
193 pVelocity->z = v44; | 197 case OBJECT_Actor: |
194 switch ( v2 ) | 198 if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) ) |
195 { | 199 ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61); |
196 case OBJECT_Player: | 200 break; |
197 DamageMonsterFromParty(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); | 201 case OBJECT_Item: |
198 break; | 202 sub_43B057(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]); |
199 case OBJECT_Actor: | 203 break; |
200 if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) ) | |
201 ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity, v36->field_61); | |
202 break; | |
203 case OBJECT_Item: | |
204 sub_43B057(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); | |
205 break; | |
206 } | |
207 } | 204 } |
208 } | 205 } |
209 } | 206 } |
210 } | 207 } |
211 } | 208 } |
212 } | 209 } |
213 ++pVelocity; | 210 } |
214 } | 211 } |
215 } | 212 AttackerInfo.count = 0; |
216 AgressorAtackInfo.count = 0; | |
217 } | 213 } |
218 | 214 |
219 | 215 |
220 //----- (0043A97E) -------------------------------------------------------- | 216 //----- (0043A97E) -------------------------------------------------------- |
221 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | 217 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) |
337 } | 333 } |
338 } | 334 } |
339 } | 335 } |
340 | 336 |
341 //----- (0043B1B0) -------------------------------------------------------- | 337 //----- (0043B1B0) -------------------------------------------------------- |
342 void ActorDamageFromMonster(signed int agressor_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) | 338 void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) |
343 { | 339 { |
344 int v4; // ebx@1 | 340 int v4; // ebx@1 |
345 //SpriteObject *v5; // eax@2 | 341 //SpriteObject *v5; // eax@2 |
346 int v6; // eax@3 | 342 int v6; // eax@3 |
347 Actor *v7; // esi@4 | 343 //Actor *v7; // esi@4 |
348 Actor *v8; // edi@4 | 344 //Actor *v8; // edi@4 |
349 char v9; // zf@5 | 345 char v9; // zf@5 |
350 __int64 v10; // qax@8 | 346 __int64 v10; // qax@8 |
351 signed __int16 v11; // cx@9 | 347 signed __int16 v11; // cx@9 |
352 signed int v12; // ecx@20 | 348 signed int v12; // ecx@20 |
353 int v13; // ecx@22 | 349 int v13; // ecx@22 |
355 //unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | 351 //unsigned int uActorID; // [sp+Ch] [bp-8h]@1 |
356 signed int v17; // [sp+10h] [bp-4h]@1 | 352 signed int v17; // [sp+10h] [bp-4h]@1 |
357 int v18; // [sp+20h] [bp+Ch]@34 | 353 int v18; // [sp+20h] [bp+Ch]@34 |
358 | 354 |
359 v4 = 0; | 355 v4 = 0; |
360 v17 = agressor_id; | 356 v17 = attacker_id; |
361 if ( PID_TYPE(agressor_id) == OBJECT_Item) | 357 if ( PID_TYPE(attacker_id) == OBJECT_Item) |
362 { | 358 { |
363 v4 = pSpriteObjects[PID_ID(agressor_id)].field_60_distance_related_prolly_lod; | 359 v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod; |
364 v17 = pSpriteObjects[PID_ID(agressor_id)].spell_caster_pid; | 360 v17 = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid; |
365 } | 361 } |
366 if ( PID_TYPE(v17) == OBJECT_Actor) | 362 if ( PID_TYPE(v17) == OBJECT_Actor) |
367 { | 363 { |
368 v7 = &pActors[actor_id]; | |
369 v8 = &pActors[PID_ID(v17)]; | |
370 v6 = pActors[actor_id].IsNotAlive(); | 364 v6 = pActors[actor_id].IsNotAlive(); |
371 if ( !v6 ) | 365 if ( !v6 ) |
372 { | 366 { |
373 v9 = v7->uAIState == 7; | 367 v9 = pActors[actor_id].uAIState == 7; |
374 v7->uLastCharacterIDToHit = v17; | 368 pActors[actor_id].uLastCharacterIDToHit = v17; |
375 if ( v9 ) | 369 if ( v9 ) |
376 BYTE2(v7->uAttributes) |= 2u; | 370 BYTE2(pActors[actor_id].uAttributes) |= 2u; |
377 v6 = v8->_4273BB_DoesHitOtherActor(v7, v4, 0); | 371 v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0); |
378 if ( v6 ) | 372 if ( v6 ) |
379 { | 373 { |
380 v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4); | 374 v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4); |
381 if ( (signed __int64)v8->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) | 375 if ( (signed __int64)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) |
382 { | 376 { |
383 v11 = v8->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; | 377 v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; |
384 if ( v11 ) | 378 if ( v11 ) |
385 v10 = (signed int)v10 / (unsigned __int16)v11; | 379 v10 = (signed int)v10 / (unsigned __int16)v11; |
386 } | 380 } |
387 if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) | 381 if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) |
388 && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) | 382 && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) |
389 || LODWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) ) | 383 || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) ) |
390 LODWORD(v10) = 0; | 384 LODWORD(v10) = 0; |
391 if ( a4 != HIDWORD(v10) ) | 385 if ( a4 != HIDWORD(v10) ) |
392 { | 386 { |
393 if ( a4 - HIDWORD(v10) == 1 ) | 387 if ( a4 - HIDWORD(v10) == 1 ) |
394 { | 388 { |
395 v12 = v8->pMonsterInfo.uAttack2Type; | 389 v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack2Type; |
396 if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) | 390 if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) |
397 && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) | 391 && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) |
398 || LODWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) | 392 || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) |
399 LODWORD(v10) = (signed int)v10 >> 1; | 393 LODWORD(v10) = (signed int)v10 >> 1; |
400 goto LABEL_30; | 394 goto LABEL_30; |
401 } | 395 } |
402 if ( a4 - HIDWORD(v10) == 2 ) | 396 if ( a4 - HIDWORD(v10) == 2 ) |
403 { | 397 { |
404 v13 = v7->pMonsterInfo.uSpell1ID; | 398 v13 = pActors[actor_id].pMonsterInfo.uSpell1ID; |
405 } | 399 } |
406 else | 400 else |
407 { | 401 { |
408 if ( a4 - HIDWORD(v10) != 3 ) | 402 if ( a4 - HIDWORD(v10) != 3 ) |
409 { | 403 { |
410 if ( a4 - HIDWORD(v10) == 4 ) | 404 if ( a4 - HIDWORD(v10) == 4 ) |
411 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | 405 v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack; |
412 else | 406 else |
413 v12 = 4; | 407 v12 = 4; |
414 LABEL_30: | 408 LABEL_30: |
415 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | 409 v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10); |
416 v7->sCurrentHP -= v14; | 410 pActors[actor_id].sCurrentHP -= v14; |
417 if ( v14 ) | 411 if ( v14 ) |
418 { | 412 { |
419 if ( v7->sCurrentHP > 0 ) | 413 if ( pActors[actor_id].sCurrentHP > 0 ) |
420 Actor::AI_Stun(actor_id, v17, 0); | 414 Actor::AI_Stun(actor_id, v17, 0); |
421 else | 415 else |
422 Actor::Die(actor_id); | 416 Actor::Die(actor_id); |
423 Actor::AggroSurroundingPeasants(actor_id, 0); | 417 Actor::AggroSurroundingPeasants(actor_id, 0); |
424 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; | 418 v18 = 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP; |
425 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | 419 if ( 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP > 10 ) |
426 v18 = 10; | 420 v18 = 10; |
427 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | 421 if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) |
428 { | 422 { |
429 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | 423 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; |
430 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | 424 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; |
431 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | 425 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; |
432 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | 426 pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x); |
433 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | 427 pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y); |
434 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | 428 pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z); |
435 } | 429 } |
436 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14); | 430 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14); |
437 } | 431 } |
438 else | 432 else |
439 { | 433 { |
440 Actor::AI_Stun(actor_id, v17, 0); | 434 Actor::AI_Stun(actor_id, v17, 0); |
441 } | 435 } |
442 return; | 436 return; |
443 } | 437 } |
444 v13 = v7->pMonsterInfo.uSpell2ID; | 438 v13 = pActors[actor_id].pMonsterInfo.uSpell2ID; |
445 } | 439 } |
446 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | 440 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); |
447 goto LABEL_30; | 441 goto LABEL_30; |
448 } | 442 } |
449 v12 = v8->pMonsterInfo.uAttack1Type; | 443 v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type; |
450 goto LABEL_30; | 444 goto LABEL_30; |
451 } | 445 } |
452 } | 446 } |
453 } | 447 } |
454 } | 448 } |