comparison mm7_5.cpp @ 1060:b79139c3b5c8

some AI cleaning
author zipi
date Thu, 23 May 2013 20:51:27 +0100
parents 37498d2cceed
children 9c7eb4037567
comparison
equal deleted inserted replaced
1059:0e0f1192aa57 1060:b79139c3b5c8
4670 player->PlaySound(SPEECH_52, 0); 4670 player->PlaySound(SPEECH_52, 0);
4671 return; 4671 return;
4672 } 4672 }
4673 if ( pMonster->sCurrentHP > 0 ) 4673 if ( pMonster->sCurrentHP > 0 )
4674 { 4674 {
4675 Actor::Stun(uActorID_Monster_, a1, 0); 4675 Actor::AI_Stun(uActorID_Monster_, a1, 0);
4676 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); 4676 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
4677 if ( bShowDamage ) 4677 if ( bShowDamage )
4678 { 4678 {
4679 v50 = uDamageAmount; 4679 v50 = uDamageAmount;
4680 pMonsterName = (char *)pMonster; 4680 pMonsterName = (char *)pMonster;
5005 v7->sCurrentHP -= v26; 5005 v7->sCurrentHP -= v26;
5006 if ( v26 ) 5006 if ( v26 )
5007 { 5007 {
5008 if ( v7->sCurrentHP >= 1 ) 5008 if ( v7->sCurrentHP >= 1 )
5009 { 5009 {
5010 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); 5010 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
5011 Actor::AggroSurroundingPeasants(uActorID, 1); 5011 Actor::AggroSurroundingPeasants(uActorID, 1);
5012 } 5012 }
5013 else 5013 else
5014 { 5014 {
5015 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) 5015 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 )
5191 v44->sCurrentHP -= v56; 5191 v44->sCurrentHP -= v56;
5192 if ( v56 ) 5192 if ( v56 )
5193 { 5193 {
5194 if ( v44->sCurrentHP >= 1 ) 5194 if ( v44->sCurrentHP >= 1 )
5195 { 5195 {
5196 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); 5196 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
5197 Actor::AggroSurroundingPeasants(uActorID, 1); 5197 Actor::AggroSurroundingPeasants(uActorID, 1);
5198 } 5198 }
5199 else 5199 else
5200 { 5200 {
5201 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) 5201 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 )
5457 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); 5457 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6);
5458 pActor->sCurrentHP -= v7; 5458 pActor->sCurrentHP -= v7;
5459 if ( v7 ) 5459 if ( v7 )
5460 { 5460 {
5461 if ( pActor->sCurrentHP > 0 ) 5461 if ( pActor->sCurrentHP > 0 )
5462 Actor::Stun(uActorIDa, a2, 0); 5462 Actor::AI_Stun(uActorIDa, a2, 0);
5463 else 5463 else
5464 Actor::Die(uActorIDa); 5464 Actor::Die(uActorIDa);
5465 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; 5465 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP;
5466 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) 5466 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 )
5467 a2a = 10; 5467 a2a = 10;
5476 } 5476 }
5477 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); 5477 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7);
5478 } 5478 }
5479 else 5479 else
5480 { 5480 {
5481 Actor::Stun(uActorIDa, a2, 0); 5481 Actor::AI_Stun(uActorIDa, a2, 0);
5482 } 5482 }
5483 } 5483 }
5484 } 5484 }
5485 } 5485 }
5486 } 5486 }
5565 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); 5565 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10);
5566 v7->sCurrentHP -= v14; 5566 v7->sCurrentHP -= v14;
5567 if ( v14 ) 5567 if ( v14 )
5568 { 5568 {
5569 if ( v7->sCurrentHP > 0 ) 5569 if ( v7->sCurrentHP > 0 )
5570 Actor::Stun(uActorID, v17, 0); 5570 Actor::AI_Stun(uActorID, v17, 0);
5571 else 5571 else
5572 Actor::Die(uActorID); 5572 Actor::Die(uActorID);
5573 Actor::AggroSurroundingPeasants(uActorID, 0); 5573 Actor::AggroSurroundingPeasants(uActorID, 0);
5574 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; 5574 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP;
5575 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) 5575 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 )
5585 } 5585 }
5586 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); 5586 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14);
5587 } 5587 }
5588 else 5588 else
5589 { 5589 {
5590 Actor::Stun(uActorID, v17, 0); 5590 Actor::AI_Stun(uActorID, v17, 0);
5591 } 5591 }
5592 return; 5592 return;
5593 } 5593 }
5594 v13 = v7->pMonsterInfo.uSpell2ID; 5594 v13 = v7->pMonsterInfo.uSpell2ID;
5595 } 5595 }
6882 { 6882 {
6883 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; 6883 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1;
6884 v22 = 2; 6884 v22 = 2;
6885 v17 = v5->pMonsterInfo.uSpell1ID; 6885 v17 = v5->pMonsterInfo.uSpell1ID;
6886 } 6886 }
6887 Actor::SpellAttack(v4, &a4, v17, v22, v24); 6887 Actor::AI_SpellAttack(v4, &a4, v17, v22, v24);
6888 LABEL_25: 6888 LABEL_25:
6889 v16 = a2a; 6889 v16 = a2a;
6890 v23 = &a4; 6890 v23 = &a4;
6891 v21 = 0; 6891 v21 = 0;
6892 v15 = v4; 6892 v15 = v4;
6898 else 6898 else
6899 { 6899 {
6900 v18 = v5->pMonsterInfo.uMissleAttack1Type; 6900 v18 = v5->pMonsterInfo.uMissleAttack1Type;
6901 v25 = 0; 6901 v25 = 0;
6902 } 6902 }
6903 Actor::RangedAttack(v4, &a4, v18, v25); 6903 Actor::AI_RangedAttack(v4, &a4, v18, v25);
6904 goto LABEL_25; 6904 goto LABEL_25;
6905 } 6905 }
6906 } 6906 }
6907 } 6907 }
6908 } 6908 }
7013 v14 = stru_50C198.special_ability_use_check(v5, a2a); 7013 v14 = stru_50C198.special_ability_use_check(v5, a2a);
7014 if ( v14 == 1 ) 7014 if ( v14 == 1 )
7015 { 7015 {
7016 if ( v5->pMonsterInfo.uMissleAttack2Type ) 7016 if ( v5->pMonsterInfo.uMissleAttack2Type )
7017 { 7017 {
7018 Actor::MissileAttack2(v13, v22, &v18); 7018 Actor::AI_MissileAttack2(v13, v22, &v18);
7019 goto LABEL_43; 7019 goto LABEL_43;
7020 } 7020 }
7021 } 7021 }
7022 else 7022 else
7023 { 7023 {
7028 else 7028 else
7029 v15 = v5->pMonsterInfo.uSpell2ID; 7029 v15 = v5->pMonsterInfo.uSpell2ID;
7030 if ( v15 ) 7030 if ( v15 )
7031 { 7031 {
7032 if ( v14 == 2 ) 7032 if ( v14 == 2 )
7033 Actor::SpellAttack1(v13, v22, &v18); 7033 Actor::AI_SpellAttack1(v13, v22, &v18);
7034 else 7034 else
7035 Actor::SpellAttack2(v13, v22, &v18); 7035 Actor::AI_SpellAttack2(v13, v22, &v18);
7036 goto LABEL_43; 7036 goto LABEL_43;
7037 } 7037 }
7038 goto LABEL_44; 7038 goto LABEL_44;
7039 } 7039 }
7040 if ( v5->pMonsterInfo.uMissleAttack1Type ) 7040 if ( v5->pMonsterInfo.uMissleAttack1Type )
7041 { 7041 {
7042 Actor::MissileAttack1(v13, v22, &v18); 7042 Actor::AI_MissileAttack1(v13, v22, &v18);
7043 LABEL_43: 7043 LABEL_43:
7044 //v3 = v21; 7044 //v3 = v21;
7045 v21->field_C = 1; 7045 v21->field_C = 1;
7046 LABEL_48: 7046 LABEL_48:
7047 v21->uActionLength = v5->uCurrentActionLength; 7047 v21->uActionLength = v5->uCurrentActionLength;
7050 } 7050 }
7051 } 7051 }
7052 LABEL_44: 7052 LABEL_44:
7053 if ( (double)(signed int)v20 < 307.2 ) 7053 if ( (double)(signed int)v20 < 307.2 )
7054 { 7054 {
7055 Actor::MeleeAttack(v13, v22, &v18); 7055 Actor::AI_MeleeAttack(v13, v22, &v18);
7056 //v3 = v21; 7056 //v3 = v21;
7057 v21->field_C = 3; 7057 v21->field_C = 3;
7058 goto LABEL_48; 7058 goto LABEL_48;
7059 } 7059 }
7060 LABEL_47: 7060 LABEL_47:
7329 LABEL_21: 7329 LABEL_21:
7330 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) 7330 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 )
7331 { 7331 {
7332 if ( (signed int)v11 < 10240 ) 7332 if ( (signed int)v11 < 10240 )
7333 { 7333 {
7334 Actor::Flee(uActorID, a2a, 0, &pDir); 7334 Actor::AI_Flee(uActorID, a2a, 0, &pDir);
7335 v29->field_C = 4; 7335 v29->field_C = 4;
7336 v29->uActionLength = actor->uCurrentActionLength; 7336 v29->uActionLength = actor->uCurrentActionLength;
7337 return 1; 7337 return 1;
7338 } 7338 }
7339 Actor::_4032B2(uActorID, a2a, 1024, 0); 7339 Actor::AI_4032B2(uActorID, a2a, 1024, 0);
7340 v29->field_C = 2; 7340 v29->field_C = 2;
7341 v29->uActionLength = actor->uCurrentActionLength; 7341 v29->uActionLength = actor->uCurrentActionLength;
7342 return 1; 7342 return 1;
7343 } 7343 }
7344 if ( actor->pMonsterInfo.uHostilityType != 4 ) 7344 if ( actor->pMonsterInfo.uHostilityType != 4 )
7352 Actor::AI_Stand(uActorID, a2a, 32, 0); 7352 Actor::AI_Stand(uActorID, a2a, 32, 0);
7353 v29->field_C = 4; 7353 v29->field_C = 4;
7354 v29->uActionLength = actor->uCurrentActionLength; 7354 v29->uActionLength = actor->uCurrentActionLength;
7355 return 1; 7355 return 1;
7356 } 7356 }
7357 Actor::Flee(uActorID, a2a, 32, 0); 7357 Actor::AI_Flee(uActorID, a2a, 32, 0);
7358 v29->field_C = 4; 7358 v29->field_C = 4;
7359 v29->uActionLength = actor->uCurrentActionLength; 7359 v29->uActionLength = actor->uCurrentActionLength;
7360 return 1; 7360 return 1;
7361 } 7361 }
7362 if ( actor->pMonsterInfo.uAIType == 2 ) 7362 if ( actor->pMonsterInfo.uAIType == 2 )
7371 Actor::AI_Stand(uActorID, a2a, 32, 0); 7371 Actor::AI_Stand(uActorID, a2a, 32, 0);
7372 v29->field_C = 4; 7372 v29->field_C = 4;
7373 v29->uActionLength = actor->uCurrentActionLength; 7373 v29->uActionLength = actor->uCurrentActionLength;
7374 return 1; 7374 return 1;
7375 } 7375 }
7376 Actor::Flee(uActorID, a2a, 32, 0); 7376 Actor::AI_Flee(uActorID, a2a, 32, 0);
7377 v29->field_C = 4; 7377 v29->field_C = 4;
7378 v29->uActionLength = actor->uCurrentActionLength; 7378 v29->uActionLength = actor->uCurrentActionLength;
7379 return 1; 7379 return 1;
7380 } 7380 }
7381 goto LABEL_39; 7381 goto LABEL_39;
7392 Actor::AI_Stand(uActorID, a2a, 32, 0); 7392 Actor::AI_Stand(uActorID, a2a, 32, 0);
7393 v29->field_C = 4; 7393 v29->field_C = 4;
7394 v29->uActionLength = actor->uCurrentActionLength; 7394 v29->uActionLength = actor->uCurrentActionLength;
7395 return 1; 7395 return 1;
7396 } 7396 }
7397 Actor::Flee(uActorID, a2a, 32, 0); 7397 Actor::AI_Flee(uActorID, a2a, 32, 0);
7398 v29->field_C = 4; 7398 v29->field_C = 4;
7399 v29->uActionLength = actor->uCurrentActionLength; 7399 v29->uActionLength = actor->uCurrentActionLength;
7400 return 1; 7400 return 1;
7401 } 7401 }
7402 goto LABEL_39; 7402 goto LABEL_39;
7406 if ( (double)(signed int)v28 < 307.2 ) 7406 if ( (double)(signed int)v28 < 307.2 )
7407 return 0; 7407 return 0;
7408 if ( (signed int)v11 < 5120 ) 7408 if ( (signed int)v11 < 5120 )
7409 { 7409 {
7410 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) 7410 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 )
7411 Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); 7411 Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir);
7412 else 7412 else
7413 Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); 7413 Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307);
7414 v29->field_C = 2; 7414 v29->field_C = 2;
7415 v29->uActionLength = actor->uCurrentActionLength; 7415 v29->uActionLength = actor->uCurrentActionLength;
7416 return 1; 7416 return 1;
7417 } 7417 }
7418 LABEL_46: 7418 LABEL_46:
7419 if ( !actor->pMonsterInfo.uMovementType ) 7419 if ( !actor->pMonsterInfo.uMovementType )
7420 { 7420 {
7421 Actor::_4032B2(uActorID, a2a, 1024, 32); 7421 Actor::AI_4032B2(uActorID, a2a, 1024, 32);
7422 v29->field_C = 2; 7422 v29->field_C = 2;
7423 v29->uActionLength = actor->uCurrentActionLength; 7423 v29->uActionLength = actor->uCurrentActionLength;
7424 return 1; 7424 return 1;
7425 } 7425 }
7426 if ( actor->pMonsterInfo.uMovementType == 1 ) 7426 if ( actor->pMonsterInfo.uMovementType == 1 )
7427 { 7427 {
7428 Actor::_4032B2(uActorID, a2a, 2560, 32); 7428 Actor::AI_4032B2(uActorID, a2a, 2560, 32);
7429 v29->field_C = 2; 7429 v29->field_C = 2;
7430 v29->uActionLength = actor->uCurrentActionLength; 7430 v29->uActionLength = actor->uCurrentActionLength;
7431 return 1; 7431 return 1;
7432 } 7432 }
7433 if ( actor->pMonsterInfo.uMovementType == 2 ) 7433 if ( actor->pMonsterInfo.uMovementType == 2 )
7434 { 7434 {
7435 Actor::_4032B2(uActorID, a2a, 5120, 32); 7435 Actor::AI_4032B2(uActorID, a2a, 5120, 32);
7436 v29->field_C = 2; 7436 v29->field_C = 2;
7437 v29->uActionLength = actor->uCurrentActionLength; 7437 v29->uActionLength = actor->uCurrentActionLength;
7438 return 1; 7438 return 1;
7439 } 7439 }
7440 if ( actor->pMonsterInfo.uMovementType == 4 ) 7440 if ( actor->pMonsterInfo.uMovementType == 4 )
7441 { 7441 {
7442 Actor::_4032B2(uActorID, a2a, 10240, 32); 7442 Actor::AI_4032B2(uActorID, a2a, 10240, 32);
7443 v29->field_C = 2; 7443 v29->field_C = 2;
7444 v29->uActionLength = actor->uCurrentActionLength; 7444 v29->uActionLength = actor->uCurrentActionLength;
7445 return 1; 7445 return 1;
7446 } 7446 }
7447 if ( actor->pMonsterInfo.uMovementType == 5 ) 7447 if ( actor->pMonsterInfo.uMovementType == 5 )