comparison Actor.cpp @ 1859:f135ff4decbb

Actor::AI_SpellAttack finishing cleanup
author Grumpy7
date Mon, 14 Oct 2013 03:17:25 +0200
parents d7c028a6a084
children 3186f469323a
comparison
equal deleted inserted replaced
1858:d7c028a6a084 1859:f135ff4decbb
200 } 200 }
201 201
202 //----- (00404AC7) -------------------------------------------------------- 202 //----- (00404AC7) --------------------------------------------------------
203 void __fastcall Actor::AI_SpellAttack(unsigned int uActorID, AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel) 203 void __fastcall Actor::AI_SpellAttack(unsigned int uActorID, AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel)
204 { 204 {
205 Actor *v5; // esi@1 205 Actor *actorPtr; // esi@1
206 unsigned int realPoints; // edi@1 206 unsigned int realPoints; // edi@1
207 unsigned int masteryLevel; // eax@1 207 unsigned int masteryLevel; // eax@1
208 int v8; // edi@16 208 int v8; // edi@16
209 signed int v10; // ecx@22 209 signed int v10; // ecx@22
210 int v19; // edi@34 210 int v19; // edi@34
235 signed int v89; // ecx@192 235 signed int v89; // ecx@192
236 signed int v91; // eax@200 236 signed int v91; // eax@200
237 int v94; // ecx@208 237 int v94; // ecx@208
238 int v96; // ecx@217 238 int v96; // ecx@217
239 int pitch; // [sp+2Ch] [bp-A4h]@51 239 int pitch; // [sp+2Ch] [bp-A4h]@51
240 int v111; // [sp+38h] [bp-98h]@41
241 int v113; // [sp+40h] [bp-90h]@41
242 int v114; // [sp+48h] [bp-88h]@41 240 int v114; // [sp+48h] [bp-88h]@41
243 SpriteObject a1; // [sp+4Ch] [bp-84h]@1 241 SpriteObject a1; // [sp+4Ch] [bp-84h]@1
244 int v116; // [sp+BCh] [bp-14h]@49 242 int v116; // [sp+BCh] [bp-14h]@49
245 int v118; // [sp+C4h] [bp-Ch]@29 243 int v118; // [sp+C4h] [bp-Ch]@29
246 float v119; // [sp+C8h] [bp-8h]@48 244 float v119; // [sp+C8h] [bp-8h]@48
251 int spellnume; // [sp+D8h] [bp+8h]@179 249 int spellnume; // [sp+D8h] [bp+8h]@179
252 int a1a; // [sp+E0h] [bp+10h]@34 250 int a1a; // [sp+E0h] [bp+10h]@34
253 int a1c; // [sp+E0h] [bp+10h]@184 251 int a1c; // [sp+E0h] [bp+10h]@184
254 252
255 253
256 LODWORD(v120) = uActorID; 254 actorPtr = &pActors[uActorID];
257 v5 = &pActors[uActorID];
258 realPoints = uSkillLevel & 0x3F; 255 realPoints = uSkillLevel & 0x3F;
259 masteryLevel = SkillToMastery(uSkillLevel); 256 masteryLevel = SkillToMastery(uSkillLevel);
260 257
261 switch (uSpellID) 258 switch (uSpellID)
262 { 259 {
263 case 2: 260 case SPELL_FIRE_FIRE_BOLT:
264 case 6: 261 case SPELL_FIRE_FIREBALL:
265 case 11: 262 case SPELL_FIRE_INCINERATE:
266 case 18: 263 case SPELL_AIR_LIGHNING_BOLT:
267 case 26: 264 case SPELL_WATER_ICE_BOLT:
268 case 29: 265 case SPELL_WATER_ACID_BURST:
269 case 39: 266 case SPELL_EARTH_BLADES:
270 case 41: 267 case SPELL_EARTH_ROCK_BLAST:
271 case 57: 268 case SPELL_MIND_MIND_BLAST:
272 case 65: 269 case SPELL_MIND_PSYCHIC_SHOCK:
273 case 70: 270 case SPELL_BODY_HARM:
274 case 78: 271 case SPELL_LIGHT_LIGHT_BOLT:
275 case 90: 272 case SPELL_DARK_TOXIC_CLOUD:
276 case 97: 273 case SPELL_DARK_DRAGON_BREATH:
277 a1.uType = stru_4E3ACC[uSpellID].uType; 274 a1.uType = stru_4E3ACC[uSpellID].uType;
278 a1.uObjectDescID = 0; 275 a1.uObjectDescID = GetObjDescId(uSpellID);
279 for (int i = 0; i < pObjectList->uNumObjects; i++)
280 {
281 if (a1.uType == pObjectList->pObjects[i].uObjectID)
282 {
283 a1.uObjectDescID = i;
284 break;
285 }
286 }
287 a1.stru_24.Reset(); 276 a1.stru_24.Reset();
288 a1.spell_id = uSpellID; 277 a1.spell_id = uSpellID;
289 a1.spell_level = uSkillLevel; 278 a1.spell_level = uSkillLevel;
290 a1.vPosition.x = v5->vPosition.x; 279 a1.vPosition.x = actorPtr->vPosition.x;
291 a1.spell_skill = 0; 280 a1.spell_skill = 0;
292 a1.vPosition.y = v5->vPosition.y; 281 a1.vPosition.y = actorPtr->vPosition.y;
293 a1.vPosition.z = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); 282 a1.vPosition.z = actorPtr->vPosition.z + ((signed int)actorPtr->uActorHeight >> 1);
294 a1.uFacing = LOWORD(pDir->uYawAngle); 283 a1.uFacing = LOWORD(pDir->uYawAngle);
295 a1.uSoundID = 0; 284 a1.uSoundID = 0;
296 a1.uAttributes = 0; 285 a1.uAttributes = 0;
297 v89 = pDir->uDistance; 286 v89 = pDir->uDistance;
298 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); 287 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
320 return; 309 return;
321 } 310 }
322 return; 311 return;
323 break; 312 break;
324 313
325 case 5: 314 case SPELL_FIRE_HASTE:
326 if (masteryLevel == 1 || masteryLevel == 2) 315 if (masteryLevel == 1 || masteryLevel == 2)
327 v39 = 60 * (realPoints + 60); 316 v39 = 60 * (realPoints + 60);
328 else if (masteryLevel == 3 ) 317 else if (masteryLevel == 3 )
329 v39 = 180 * (realPoints + 20); 318 v39 = 180 * (realPoints + 20);
330 else if (masteryLevel == 4 ) 319 else if (masteryLevel == 4 )
331 v39 = 240 * (realPoints + 15); 320 v39 = 240 * (realPoints + 15);
332 else 321 else
333 v39 = 0; 322 v39 = 0;
334 v5->pActorBuffs[19].Apply( 323 actorPtr->pActorBuffs[19].Apply(
335 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335), 324 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
336 masteryLevel, 325 masteryLevel,
337 0, 326 0,
338 0, 327 0,
339 0); 328 0);
340 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFF3C1Eu); 329 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu);
341 pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 330 pAudioPlayer->PlaySound((SoundID)10040, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
342 return; 331 return;
343 332
344 case 9: 333 case SPELL_FIRE_METEOR_SHOWER:
345 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 334 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
346 return; 335 return;
347 v118 = pParty->vPosition.z;
348 v111 = pParty->vPosition.x;
349 v114 = pParty->vPosition.z + 2500; 336 v114 = pParty->vPosition.z + 2500;
350 v113 = pParty->vPosition.y;
351 v23 = 8; 337 v23 = 8;
352 if (masteryLevel == 2) 338 if (masteryLevel == 2)
353 v23 = 10; 339 v23 = 10;
354 else if (masteryLevel == 3) 340 else if (masteryLevel == 3)
355 v23 = 12; 341 v23 = 12;
358 spellnumb = 0; 344 spellnumb = 0;
359 for ( int i = 0; i < v23; i++) 345 for ( int i = 0; i < v23; i++)
360 { 346 {
361 v28 = (double)spellnumb; 347 v28 = (double)spellnumb;
362 v30 = rand() % 1000; 348 v30 = rand() % 1000;
363 spellnumc = v30 + pParty->vPosition.z - v114; 349 spellnumc = v30 - 2500;
364 v120 = v28 * v28; 350 v120 = v28 * v28;
365 v119 = spellnumb * spellnumb; 351 v119 = spellnumb * spellnumb;
366 if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 ) 352 if ( sqrt(spellnumc * spellnumc + v119 + v120) <= 1.0 )
367 { 353 {
368 v32 = 0; 354 v32 = 0;
373 v31 = (signed __int64)sqrt(v119 + v120); 359 v31 = (signed __int64)sqrt(v119 + v120);
374 v32 = stru_5C6E00->Atan2(spellnumb, (int)v28); 360 v32 = stru_5C6E00->Atan2(spellnumb, (int)v28);
375 pitch = stru_5C6E00->Atan2(v31, (int)spellnumc); 361 pitch = stru_5C6E00->Atan2(v31, (int)spellnumc);
376 } 362 }
377 a1.stru_24.Reset(); 363 a1.stru_24.Reset();
378 a1.uType = stru_4E3ACC[9].uType; 364 a1.uType = stru_4E3ACC[uSpellID].uType;
379 a1.uObjectDescID = 0; 365 a1.uObjectDescID = GetObjDescId(uSpellID);
380 for (int i = 0; i < pObjectList->uNumObjects; i++)
381 {
382 if (pObjectList->pObjects[i].uObjectID == a1.uType)
383 {
384 a1.uObjectDescID = i;
385 break;
386 }
387 }
388 a1.spell_level = uSkillLevel; 366 a1.spell_level = uSkillLevel;
389 a1.vPosition.x = pParty->vPosition.x; 367 a1.vPosition.x = pParty->vPosition.x;
390 a1.vPosition.y = pParty->vPosition.y; 368 a1.vPosition.y = pParty->vPosition.y;
391 a1.vPosition.z = v30 + v114; 369 a1.vPosition.z = v30 + v114;
392 a1.spell_id = SPELL_FIRE_METEOR_SHOWER; 370 a1.spell_id = SPELL_FIRE_METEOR_SHOWER;
420 spellnumb = rand() % 1024 - 512; 398 spellnumb = rand() % 1024 - 512;
421 } 399 }
422 return; 400 return;
423 break; 401 break;
424 402
425 case 15:if (masteryLevel == 2 ) 403 case SPELL_AIR_SPARKS:
404 if (masteryLevel == 2 )
426 v10 = 5; 405 v10 = 5;
427 else if (masteryLevel == 3 ) 406 else if (masteryLevel == 3 )
428 v10 = 7; 407 v10 = 7;
429 else if (masteryLevel == 4 ) 408 else if (masteryLevel == 4 )
430 v10 = 9; 409 v10 = 9;
431 else 410 else
432 v10 = 3; 411 v10 = 3;
433 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 412 spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
434 a1.uType = stru_4E3ACC[15].uType; 413 a1.uType = stru_4E3ACC[uSpellID].uType;
435 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1); 414 v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1);
436 a1.uObjectDescID = 0; 415 a1.uObjectDescID = GetObjDescId(uSpellID);
437 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++) 416
438 {
439 if (stru_4E3ACC[15].uType == pObjectList->pObjects[i].uObjectID)
440 {
441 a1.uObjectDescID = i;
442 break;
443 }
444 }
445 a1.stru_24.Reset(); 417 a1.stru_24.Reset();
446 a1.spell_id = SPELL_AIR_SPARKS; 418 a1.spell_id = SPELL_AIR_SPARKS;
447 a1.spell_level = uSkillLevel; 419 a1.spell_level = uSkillLevel;
448 a1.vPosition.x = v5->vPosition.x; 420 a1.vPosition.x = actorPtr->vPosition.x;
449 a1.spell_skill = 0; 421 a1.spell_skill = 0;
450 a1.vPosition.y = v5->vPosition.y; 422 a1.vPosition.y = actorPtr->vPosition.y;
451 a1.vPosition.z = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); 423 a1.vPosition.z = actorPtr->vPosition.z + ((signed int)actorPtr->uActorHeight >> 1);
452 a1.uFacing = pDir->uYawAngle; 424 a1.uFacing = pDir->uYawAngle;
453 a1.uSoundID = 0; 425 a1.uSoundID = 0;
454 a1.uAttributes = 0; 426 a1.uAttributes = 0;
455 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); 427 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
456 a1.spell_caster_pid = PID(OBJECT_Actor, LODWORD(v120)); 428 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID);
457 a1.uSpriteFrameID = 0; 429 a1.uSpriteFrameID = 0;
458 a1.spell_target_pid = 0; 430 a1.spell_target_pid = 0;
459 a1.field_60_distance_related_prolly_lod = 3; 431 a1.field_60_distance_related_prolly_lod = 3;
460 v19 = spellnuma / -2; 432 v19 = spellnuma / -2;
461 a1a = spellnuma / 2; 433 a1a = spellnuma / 2;
483 return; 455 return;
484 } 456 }
485 return; 457 return;
486 break; 458 break;
487 459
488 case 17: 460 case SPELL_AIR_SHIELD:
489 if (masteryLevel == 1 || masteryLevel == 2) 461 if (masteryLevel == 1 || masteryLevel == 2)
490 v8 = 300 * realPoints + 3840; 462 v8 = 300 * realPoints + 3840;
491 else if (masteryLevel == 3 ) 463 else if (masteryLevel == 3 )
492 v8 = 900 * realPoints + 3840; 464 v8 = 900 * realPoints + 3840;
493 else if (masteryLevel == 4 ) 465 else if (masteryLevel == 4 )
494 v8 = 3600 * (realPoints + 64); 466 v8 = 3600 * (realPoints + 64);
495 else 467 else
496 v8 = 0; 468 v8 = 0;
497 v5->pActorBuffs[15].Apply( 469 actorPtr->pActorBuffs[15].Apply(
498 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335), 470 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v8 << 7) * 0.033333335),
499 masteryLevel, 471 masteryLevel,
500 0, 472 0,
501 0, 473 0,
502 0); 474 0);
503 return; 475 return;
504 476
505 case 38: 477 case SPELL_EARTH_STONESKIN:
506 if (masteryLevel == 1 || masteryLevel == 2) 478 if (masteryLevel == 1 || masteryLevel == 2)
507 v44 = 300 * realPoints + 3840; 479 v44 = 300 * realPoints + 3840;
508 else if (masteryLevel == 3 ) 480 else if (masteryLevel == 3 )
509 v44 = 900 * realPoints + 3840; 481 v44 = 900 * realPoints + 3840;
510 else if (masteryLevel == 4 ) 482 else if (masteryLevel == 4 )
511 v44 = 3600 * (realPoints + 64); 483 v44 = 3600 * (realPoints + 64);
512 else 484 else
513 v44 = 0; 485 v44 = 0;
514 v5->pActorBuffs[16].Apply( 486 actorPtr->pActorBuffs[16].Apply(
515 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335), 487 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
516 masteryLevel, 488 masteryLevel,
517 realPoints + 5, 489 realPoints + 5,
518 0, 490 0,
519 0); 491 0);
520 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x5C310Eu); 492 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu);
521 pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); 493 pAudioPlayer->PlaySound((SoundID)13040, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
522 return; 494 return;
523 495
524 case 46: 496 case SPELL_SPIRIT_BLESS:
525 if (masteryLevel == 1 || masteryLevel == 2) 497 if (masteryLevel == 1 || masteryLevel == 2)
526 v42 = 300 * realPoints + 3840; 498 v42 = 300 * realPoints + 3840;
527 else if (masteryLevel == 3 ) 499 else if (masteryLevel == 3 )
528 v42 = 900 * realPoints + 3840; 500 v42 = 900 * realPoints + 3840;
529 else if (masteryLevel == 4 ) 501 else if (masteryLevel == 4 )
530 v42 = 1200 * realPoints + 3840; 502 v42 = 1200 * realPoints + 3840;
531 else 503 else
532 v42 = 0; 504 v42 = 0;
533 v5->pActorBuffs[17].Apply( 505 actorPtr->pActorBuffs[17].Apply(
534 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335), 506 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
535 masteryLevel, 507 masteryLevel,
536 realPoints + 5, 508 realPoints + 5,
537 0, 509 0,
538 0); 510 0);
539 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); 511 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
540 pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); 512 pAudioPlayer->PlaySound((SoundID)14010, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
541 return; 513 return;
542 break; 514 break;
543 515
544 case 47: 516 case SPELL_SPIRIT_FATE:
545 if (masteryLevel == 1 || masteryLevel == 2) 517 if (masteryLevel == 1 || masteryLevel == 2)
546 v48 = 2 * realPoints + 40; 518 v48 = 2 * realPoints + 40;
547 else if (masteryLevel == 3 ) 519 else if (masteryLevel == 3 )
548 v48 = 3 * realPoints + 60; 520 v48 = 3 * realPoints + 60;
549 else if (masteryLevel == 4 ) 521 else if (masteryLevel == 4 )
550 v48 = 2 * (3 * realPoints + 60); 522 v48 = 2 * (3 * realPoints + 60);
551 else 523 else
552 v48 = 0; 524 v48 = 0;
553 v5->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0); 525 actorPtr->pActorBuffs[11].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0);
554 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); 526 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
555 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 527 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
556 return; 528 return;
557 529
558 case 51: 530 case SPELL_SPIRIT_HEROISM:
559 if (masteryLevel == 1 || masteryLevel == 2) 531 if (masteryLevel == 1 || masteryLevel == 2)
560 v54 = 300 * realPoints + 3840; 532 v54 = 300 * realPoints + 3840;
561 else if (masteryLevel == 3 ) 533 else if (masteryLevel == 3 )
562 v54 = 900 * realPoints + 3840; 534 v54 = 900 * realPoints + 3840;
563 else if (masteryLevel == 4 ) 535 else if (masteryLevel == 4 )
564 v54 = 1200 * realPoints + 3840; 536 v54 = 1200 * realPoints + 3840;
565 else 537 else
566 v54 = 0; 538 v54 = 0;
567 v5->pActorBuffs[18].Apply( 539 actorPtr->pActorBuffs[18].Apply(
568 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335), 540 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
569 masteryLevel, 541 masteryLevel,
570 realPoints + 5, 542 realPoints + 5,
571 0, 543 0,
572 0); 544 0);
573 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0xC8C805u); 545 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
574 pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0); 546 pAudioPlayer->PlaySound((SoundID)14060, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
575 return; 547 return;
576 548
577 case 73: 549 case SPELL_BODY_HAMMERHANDS:
578 if ( (signed int)masteryLevel <= 0 || (signed int)masteryLevel > 4 ) 550 if ( (signed int)masteryLevel <= 0 || (signed int)masteryLevel > 4 )
579 v51 = 0; 551 v51 = 0;
580 else 552 else
581 v51 = 3600 * realPoints; 553 v51 = 3600 * realPoints;
582 v5->pActorBuffs[21].Apply( 554 actorPtr->pActorBuffs[21].Apply(
583 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335), 555 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v51 << 7) * 0.033333335),
584 masteryLevel, 556 masteryLevel,
585 realPoints, 557 realPoints,
586 0, 558 0,
587 0); 559 0);
588 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u); 560 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
589 pAudioPlayer->PlaySound((SoundID)16060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 561 pAudioPlayer->PlaySound((SoundID)16060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
590 return; 562 return;
591 563
592 case 77: 564 case SPELL_BODY_POWER_CURE:
593 v5->sCurrentHP += 5 * realPoints + 10; 565 actorPtr->sCurrentHP += 5 * realPoints + 10;
594 if ( v5->sCurrentHP >= (signed int)v5->pMonsterInfo.uHP ) 566 if ( actorPtr->sCurrentHP >= (signed int)actorPtr->pMonsterInfo.uHP )
595 v5->sCurrentHP = LOWORD(v5->pMonsterInfo.uHP); 567 actorPtr->sCurrentHP = LOWORD(actorPtr->pMonsterInfo.uHP);
596 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xA81376u); 568 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
597 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 569 pAudioPlayer->PlaySound((SoundID)14020, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
598 return; 570 return;
599 571
600 case 80: 572 case SPELL_LIGHT_DISPEL_MAGIC:
601 for (int i = 0; i < 20; i++ ) 573 for (int i = 0; i < 20; i++ )
602 { 574 {
603 pParty->pPartyBuffs[i].Reset(); 575 pParty->pPartyBuffs[i].Reset();
604 } 576 }
605 for (int i = 1; i <= 4; i++) 577 for (int i = 1; i <= 4; i++)
621 } 593 }
622 } 594 }
623 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[80], PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 595 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[80], PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
624 return; 596 return;
625 597
626 case 85: 598 case SPELL_LIGHT_DAY_OF_PROTECTION:
627 if (masteryLevel == 1 || masteryLevel == 2) 599 if (masteryLevel == 1 || masteryLevel == 2)
628 { 600 {
629 v96 = 300 * realPoints + 3840; 601 v96 = 300 * realPoints + 3840;
630 } 602 }
631 else if (masteryLevel == 3 ) 603 else if (masteryLevel == 3 )
641 else 613 else
642 { 614 {
643 LOWORD(realPoints) = uSkillLevel; 615 LOWORD(realPoints) = uSkillLevel;
644 v96 = 0; 616 v96 = 0;
645 } 617 }
646 v5->pActorBuffs[13].Apply( 618 actorPtr->pActorBuffs[13].Apply(
647 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335), 619 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
648 masteryLevel, 620 masteryLevel,
649 realPoints, 621 realPoints,
650 0, 622 0,
651 0); 623 0);
652 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu); 624 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
653 pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 625 pAudioPlayer->PlaySound((SoundID)17070, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
654 return; 626 return;
655 627
656 case 86: 628 case SPELL_LIGHT_HOUR_OF_POWER:
657 if (masteryLevel == 1 || masteryLevel == 2) 629 if (masteryLevel == 1 || masteryLevel == 2)
658 v94 = 300 * realPoints + 3840; 630 v94 = 300 * realPoints + 3840;
659 else if (masteryLevel == 3) 631 else if (masteryLevel == 3)
660 v94 = 900 * realPoints + 3840; 632 v94 = 900 * realPoints + 3840;
661 else if (masteryLevel == 4) 633 else if (masteryLevel == 4)
662 v94 = 1200 * realPoints + 3840; 634 v94 = 1200 * realPoints + 3840;
663 else 635 else
664 v94 = 0; 636 v94 = 0;
665 v5->pActorBuffs[14].Apply( 637 actorPtr->pActorBuffs[14].Apply(
666 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335), 638 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
667 masteryLevel, 639 masteryLevel,
668 realPoints + 5, 640 realPoints + 5,
669 0, 641 0,
670 0); 642 0);
671 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5, 0xFFFFFFu); 643 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
672 pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 644 pAudioPlayer->PlaySound((SoundID)17080, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
673 return; 645 return;
674 646
675 case 93: 647 case SPELL_DARK_SHARPMETAL:
676 if (masteryLevel == 2) 648 if (masteryLevel == 2)
677 v70 = 5; 649 v70 = 5;
678 else if (masteryLevel == 3) 650 else if (masteryLevel == 3)
679 v70 = 7; 651 v70 = 7;
680 else if (masteryLevel == 4) 652 else if (masteryLevel == 4)
681 v70 = 9; 653 v70 = 9;
682 else 654 else
683 v70 = 3; 655 v70 = 3;
684 656
685 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 657 spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
686 a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType; 658 a1.uType = stru_4E3ACC[uSpellID].uType;
687 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1); 659 v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1);
688 a1.uObjectDescID = 0; 660 a1.uObjectDescID = GetObjDescId(uSpellID);
689 for (int i = 0; i < pObjectList->uNumObjects; i++)
690 {
691 if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType)
692 {
693 a1.uObjectDescID = i;
694 break;
695 }
696 }
697 a1.stru_24.Reset(); 661 a1.stru_24.Reset();
698 a1.spell_id = SPELL_DARK_SHARPMETAL; 662 a1.spell_id = uSpellID;
699 a1.spell_level = uSkillLevel; 663 a1.spell_level = uSkillLevel;
700 a1.vPosition.x = v5->vPosition.x; 664 a1.vPosition.x = actorPtr->vPosition.x;
701 a1.spell_skill = 0; 665 a1.spell_skill = 0;
702 a1.vPosition.y = v5->vPosition.y; 666 a1.vPosition.y = actorPtr->vPosition.y;
703 a1.vPosition.z = v5->vPosition.z + ((signed int)v5->uActorHeight >> 1); 667 a1.vPosition.z = actorPtr->vPosition.z + ((signed int)actorPtr->uActorHeight >> 1);
704 a1.uFacing = pDir->uYawAngle; 668 a1.uFacing = pDir->uYawAngle;
705 a1.uSoundID = 0; 669 a1.uSoundID = 0;
706 a1.uAttributes = 0; 670 a1.uAttributes = 0;
707 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); 671 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
708 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID); 672 a1.spell_caster_pid = PID(OBJECT_Actor, uActorID);
735 return; 699 return;
736 } 700 }
737 return; 701 return;
738 break; 702 break;
739 703
740 case 95: 704 case SPELL_DARK_PAIN_REFLECTION:
741 if (masteryLevel == 0) 705 if (masteryLevel == 0)
742 v68 = 0; 706 v68 = 0;
743 else if (masteryLevel == 1 || (masteryLevel == 2) || (masteryLevel == 3)) 707 else if (masteryLevel == 1 || (masteryLevel == 2) || (masteryLevel == 3))
744 v68 = 300 * realPoints + 3840; 708 v68 = 300 * realPoints + 3840;
745 else 709 else
746 v68 = 900 * realPoints + 3840; 710 v68 = 900 * realPoints + 3840;
747 v5->pActorBuffs[20].Apply( 711 actorPtr->pActorBuffs[20].Apply(
748 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335), 712 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
749 masteryLevel, 713 masteryLevel,
750 0, 714 0,
751 0, 715 0,
752 0); 716 0);
753 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(v5,0x7E7E7Eu); 717 pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu);
754 pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0); 718 pAudioPlayer->PlaySound((SoundID)18060, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
755 return; 719 return;
756 } 720 }
757 721
758 } 722 }
723
724
725 //----- (new func) --------------------------------------------------------
726 unsigned short Actor::GetObjDescId( int spellId )
727 {
728 for (unsigned int i = 0; i < pObjectList->uNumObjects; i++)
729 {
730 if (stru_4E3ACC[spellId].uType == pObjectList->pObjects[i].uObjectID)
731 {
732 return i;
733 break;
734 }
735 }
736 return 0;
737 }
738
759 739
760 //----- (0043ABB0) -------------------------------------------------------- 740 //----- (0043ABB0) --------------------------------------------------------
761 bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2) 741 bool Actor::ArePeasantsOfSameFaction(Actor *a1, Actor *a2)
762 { 742 {
763 unsigned int v2; // esi@1 743 unsigned int v2; // esi@1