Mercurial > mm7
comparison Actor.cpp @ 2310:43af6c819e88
ActorDamageFromMonster moved into Actor class
author | Grumpy7 |
---|---|
date | Mon, 17 Mar 2014 22:52:52 +0100 |
parents | df24d11208df |
children | 9551756f46c4 |
comparison
equal
deleted
inserted
replaced
2309:a07bf9afa652 | 2310:43af6c819e88 |
---|---|
2587 | 2587 |
2588 //----- (00459667) -------------------------------------------------------- | 2588 //----- (00459667) -------------------------------------------------------- |
2589 void Actor::Remove() | 2589 void Actor::Remove() |
2590 { | 2590 { |
2591 this->uAIState = Removed; | 2591 this->uAIState = Removed; |
2592 } | |
2593 | |
2594 | |
2595 //----- (0043B1B0) -------------------------------------------------------- | |
2596 void Actor::ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) | |
2597 { | |
2598 int v4; // ebx@1 | |
2599 int dmgToRecv; // qax@8 | |
2600 signed int v12; // ecx@20 | |
2601 int finalDmg; // edi@30 | |
2602 int pushDistance; // [sp+20h] [bp+Ch]@34 | |
2603 | |
2604 v4 = 0; | |
2605 if ( PID_TYPE(attacker_id) == OBJECT_Item) | |
2606 { | |
2607 v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod; | |
2608 attacker_id = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid; | |
2609 } | |
2610 if ( PID_TYPE(attacker_id) == OBJECT_Actor) | |
2611 { | |
2612 if ( !pActors[actor_id].IsNotAlive() ) | |
2613 { | |
2614 pActors[actor_id].uLastCharacterIDToHit = attacker_id; | |
2615 if ( pActors[actor_id].uAIState == Fleeing ) | |
2616 pActors[actor_id].uAttributes |= FACE_UNKNOW7; | |
2617 if ( pActors[PID_ID(attacker_id)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) ) | |
2618 { | |
2619 dmgToRecv = pActors[PID_ID(attacker_id)]._43B3E0_CalcDamage(a4); | |
2620 if ( pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) | |
2621 { | |
2622 if ( pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower ) | |
2623 dmgToRecv = dmgToRecv / pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; | |
2624 } | |
2625 if ( pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 ) | |
2626 dmgToRecv = 0; | |
2627 if ( a4 == 0 ) | |
2628 v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.uAttack1Type; | |
2629 else if ( a4 == 1 ) | |
2630 { | |
2631 v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.uAttack2Type; | |
2632 if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 ) | |
2633 dmgToRecv = dmgToRecv / 2; | |
2634 } | |
2635 else if ( a4 == 2 ) | |
2636 v12 = pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell1ID].uSchool; | |
2637 else if ( a4 == 3 ) | |
2638 v12 = pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell2ID].uSchool; | |
2639 else if ( a4 == 4 ) | |
2640 v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.field_3C_some_special_attack; | |
2641 else | |
2642 v12 = 4; | |
2643 finalDmg = pActors[actor_id].CalcMagicalDamageToActor((DAMAGE_TYPE)v12, dmgToRecv); | |
2644 pActors[actor_id].sCurrentHP -= finalDmg; | |
2645 if ( finalDmg ) | |
2646 { | |
2647 if ( pActors[actor_id].sCurrentHP > 0 ) | |
2648 Actor::AI_Stun(actor_id, attacker_id, 0); | |
2649 else | |
2650 Actor::Die(actor_id); | |
2651 Actor::AggroSurroundingPeasants(actor_id, 0); | |
2652 pushDistance = 20 * finalDmg / pActors[actor_id].pMonsterInfo.uHP; | |
2653 if ( pushDistance > 10 ) | |
2654 pushDistance = 10; | |
2655 if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
2656 { | |
2657 pVelocity->x = (int32)fixpoint_mul(pushDistance, pVelocity->x); | |
2658 pVelocity->y = (int32)fixpoint_mul(pushDistance, pVelocity->y); | |
2659 pVelocity->z = (int32)fixpoint_mul(pushDistance, pVelocity->z); | |
2660 pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x); | |
2661 pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y); | |
2662 pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z); | |
2663 } | |
2664 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, finalDmg); | |
2665 } | |
2666 else | |
2667 Actor::AI_Stun(actor_id, attacker_id, 0); | |
2668 return; | |
2669 } | |
2670 } | |
2671 } | |
2592 } | 2672 } |
2593 | 2673 |
2594 //----- (0044FD29) -------------------------------------------------------- | 2674 //----- (0044FD29) -------------------------------------------------------- |
2595 void Actor::SummonMinion( int summonerId ) | 2675 void Actor::SummonMinion( int summonerId ) |
2596 { | 2676 { |