Mercurial > mm7
diff CastSpellInfo.cpp @ 2187:9856c2f8f918
CastSpell continue
author | Ritor1 |
---|---|
date | Tue, 28 Jan 2014 17:25:58 +0600 |
parents | 7a517c9a1d5b |
children | 0ae56373cc35 |
line wrap: on
line diff
--- a/CastSpellInfo.cpp Mon Jan 27 17:33:34 2014 +0600 +++ b/CastSpellInfo.cpp Tue Jan 28 17:25:58 2014 +0600 @@ -243,7 +243,7 @@ AIDirection a3; // [sp+C94h] [bp-1F0h]@21 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 - ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 + //ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 int v684; // [sp+D04h] [bp-180h]@416 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 @@ -2325,725 +2325,573 @@ { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if (PID_TYPE(a2) != OBJECT_Actor) + if (PID_TYPE(a2) == OBJECT_Actor) { - LODWORD(v727) = 1; - break; - } - mon_id = PID_ID(a2); - //v417 = &pActors[mon_id]; - //Actor * _v730 = v417; - if ( !(pActors[mon_id].uAttributes & 0x800000) ) - pActors[mon_id].SetRandomGoldIfTheresNoItem(); - v418 = 0; - if ( pItemsTable->pItems[pActors[mon_id].array_000234[3].uItemID].uEquipType == EQUIP_GOLD ) - v418 = pActors[mon_id].array_000234[3].uSpecEnchantmentType; - //ItemGen::ItemGen(&v683); - v683.Reset(); - //v419 = _v730->uCarriedItemID; - if (pActors[mon_id].uCarriedItemID) - v683.uItemID = pActors[mon_id].uCarriedItemID; - else - { - - //v421 = pActors[mon_id].array_000234; - //while ( !pActors[mon_id].array_000234[v420].uItemID || pActors[mon_id].array_000234[v420].GetItemEquipType() == EQUIP_GOLD ) - for ( v420 = 0; v420 < 4; ++v420 ) + mon_id = PID_ID(a2); + if ( !(pActors[mon_id].uAttributes & 0x800000) ) + pActors[mon_id].SetRandomGoldIfTheresNoItem(); + int gold_num = 0; + if ( pItemsTable->pItems[pActors[mon_id].array_000234[3].uItemID].uEquipType == EQUIP_GOLD ) + gold_num = pActors[mon_id].array_000234[3].uSpecEnchantmentType; + ItemGen item; + item.Reset(); + if (pActors[mon_id].uCarriedItemID) + item.uItemID = pActors[mon_id].uCarriedItemID; + else { - if ( pActors[mon_id].array_000234[v420].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].array_000234[v420].uItemID].uEquipType != EQUIP_GOLD ) + for ( uint i = 0; i < 4; ++i ) { - memcpy(&v683, &pActors[mon_id].array_000234[v420], sizeof(v683)); - spell_level = v723; + if ( pActors[mon_id].array_000234[i].uItemID > 0 && pItemsTable->pItems[pActors[mon_id].array_000234[i].uItemID].uEquipType != EQUIP_GOLD ) + { + memcpy(&item, &pActors[mon_id].array_000234[i], sizeof(item)); + spell_level = v723; + } } } - //if ( v420 < 4 ) - //{ - //memcpy(&v683, &pActors[mon_id].array_000234[v420], sizeof(v683)); - //spell_level = v723; - //v1 = 0; - //} - } -// LABEL_799: - if ( v418 != 0 ) - { - //v675 = _v733; - if (v683.uItemID) + if ( gold_num > 0 ) { - //v422 = v683.GetDisplayName(); - sprintf(pTmpBuf2.data(), "(%s), and %d gold", v683.GetDisplayName(), v418); + if (item.uItemID) + sprintf(pTmpBuf2.data(), "(%s), and %d gold", item.GetDisplayName(), gold_num); + else + sprintf(pTmpBuf2.data(), "%d gold", gold_num); } else { - //v664 = "%d gold"; - sprintf(pTmpBuf2.data(), "%d gold", v418); + if (item.uItemID) + sprintf(pTmpBuf2.data(), "(%s)", item.GetDisplayName()); + else + { + strcpy(pTmpBuf2.data(), "nothing"); + ShowStatusBarString(pTmpBuf2.data(), 2); + } } + ShowStatusBarString(pTmpBuf2.data(), 2); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; + pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; + pSpellSprite.vPosition.z = pActors[mon_id].uActorHeight; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - else + LODWORD(v727) = 1; + break; + } + case SPELL_MIND_BERSERK://Берсерк + { + switch (skill_level) { - if (v683.uItemID) + case 1: amount = 300 * spell_level; break; + case 2: amount = 300 * spell_level; break; + case 3: amount = 600 * spell_level; break; + case 4: amount = 3600; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + mon_id = PID_ID(a2); + if (PID_TYPE(a2) == OBJECT_Actor) + { + //v730 = 836 * mon_id; + if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) ) { - //const char *_v675 = v683.GetDisplayName(); - //v664 = "(%s)"; - sprintf(pTmpBuf2.data(), "(%s)", v683.GetDisplayName()); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), skill_level, 0, 0, 0); + pActors[mon_id].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } - else + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; + pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; + pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); + } + LODWORD(v727) = 1; + break; + } + case SPELL_MIND_ENSLAVE://Порабощение + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + amount = 600 * spell_level; + if (PID_TYPE(a2) == OBJECT_Actor) + { + mon_id = PID_ID(a2); + //v730 = 836 * mon_id; + if ( MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + break; + if ( stru_50C198.GetMagicalResistance(&pActors[mon_id], 7) ) { - strcpy(pTmpBuf2.data(), "nothing"); - ShowStatusBarString(pTmpBuf2.data(), 2); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), + skill_level, 0, 0, 0); } + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; + pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; + pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - ShowStatusBarString(pTmpBuf2.data(), 2); + LODWORD(v727) = 1; + break; + } + case SPELL_MIND_MASS_FEAR://Массовый страх + { + if ( skill_level == 4 ) + amount = 300 * spell_level; + else + amount = 180 * spell_level; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + int mon_num = pRenderer->_46А6АС_GetActorsInViewport(4096); + pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0A, 192); + ++pSpellSprite.uType; pSpellSprite.stru_24.Reset(); pSpellSprite.spell_id = pCastSpell->uSpellID; pSpellSprite.spell_level = spell_level; pSpellSprite.spell_skill = skill_level; pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; - pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; - pSpellSprite.vPosition.z = pActors[mon_id].uActorHeight; pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSectorID = 0; pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(pSpellSprite.uAttributes) |= 0x80; pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); + for ( a2 = 0; a2 < mon_num; ++a2 ) + { + if ( MonsterStats::BelongsToSupertype(pActors[_50BF30_actors_in_viewport_ids[a2]].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + break; + pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x; + pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y; + pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); + pSpellSprite.Create(0, 0, 0, 0); + if ( stru_50C198.GetMagicalResistance(&pActors[_50BF30_actors_in_viewport_ids[a2]], 7) ) + { + pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), + skill_level, 0, 0, 0); + } + } + LODWORD(v727) = 1; + break; + } + case SPELL_MIND_CURE_INSANITY://Лечение Безумия + { + if ( skill_level == 4 ) + amount = 0; + else + amount = 86400 * spell_level; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Insane] ) + { + if ( !(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak]) ) + pParty->pPlayers[pCastSpell->uPlayerID_2].PlaySound(SPEECH_25, 0); + if ( skill_level == 4 ) + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Insane] = 0; + else + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Insane, + (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 0); + } + LODWORD(v727) = 1; + break; + } + case SPELL_EARTH_TELEKINESIS://Телекинез + { + switch (skill_level) + { + case 1: amount = 2 * spell_level; break; + case 2: amount = 2 * spell_level; break; + case 3: amount = 3 * spell_level; break; + case 4: amount = 4 * spell_level; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + int obj_id = PID_ID(a2); + if (PID_TYPE(a2) == OBJECT_Item) + { + if ( pItemsTable->pItems[pSpriteObjects[obj_id].stru_24.uItemID].uEquipType == EQUIP_GOLD ) + { + pParty->PartyFindsGold(pSpriteObjects[obj_id].stru_24.uSpecEnchantmentType, 0); + viewparams->bRedrawGameUI = true; + } + else + { + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[pSpriteObjects[obj_id].stru_24.uItemID].pUnidentifiedName);//Вы нашли ^Pv[%s]! + ShowStatusBarString(pTmpBuf2.data(), 2); + if ( !pParty->AddItemToParty(&pSpriteObjects[obj_id].stru_24) ) + pParty->SetHoldingItem(&pSpriteObjects[obj_id].stru_24); + } + SpriteObject::OnInteraction(obj_id); + } + if (PID_TYPE(a2) == OBJECT_Actor) + pActors[obj_id].LootActor(); + if (PID_TYPE(a2) == OBJECT_Decoration) + { + OpenedTelekinesis = true; + if ( pLevelDecorations[obj_id].uEventID ) + EventProcessor(pLevelDecorations[obj_id].uEventID, a2, 1); + if ( pLevelDecorations[pSpriteObjects[obj_id].stru_24.uItemID].IsInteractive() ) + { + activeLevelDecoration = &pLevelDecorations[obj_id]; + EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[obj_id]._idx_in_stru123 - 75] + 380, 0, 1); + activeLevelDecoration = NULL; + } + } + if (PID_TYPE(a2) == OBJECT_BModel) + { + OpenedTelekinesis = true; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + v448 = pIndoor->pFaceExtras[pIndoor->pFaces[obj_id].uFaceExtraID].uEventID; + else + v448 = pOutdoor->pBModels[a2 >> 9].pFaces[obj_id & 0x3F].sCogTriggeredID; + EventProcessor(v448, a2, 1); + } + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_CURE_WEAKNESS://Лечить Слабость + { + switch (skill_level) + { + case 1: amount = 180 * spell_level; break;//3 минуты * количество очков навыка + case 2: amount = 3600 * spell_level; break;//1 час * количество очков навыка + case 3: amount = 86400 * spell_level; break; + case 4: amount = 0; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] ) + { + if ( skill_level == 4 ) + { + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] = 0; + LODWORD(v727) = 1; + break; + } + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Weak, + (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + } + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_FIRST_AID://Первая помощь + { + switch (skill_level) + { + case 1: amount = 2 * spell_level + 5; break; + case 2: amount = 3 * spell_level + 5; break; + case 3: amount = 4 * spell_level + 5; break; + case 4: amount = 5 * spell_level + 5; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if ( !pCastSpell->spell_target_pid ) + { + pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + } + if (PID_TYPE(pCastSpell->spell_target_pid) == OBJECT_Actor) + { + mon_id = PID_ID(pCastSpell->spell_target_pid); + if ( pActors[mon_id].uAIState != Dead && pActors[mon_id].uAIState != Dying && pActors[mon_id].uAIState != Disabled + && pActors[mon_id].uAIState != Removed ) + { + pActors[mon_id].sCurrentHP += amount; + if ( pActors[mon_id].sCurrentHP > pActors[mon_id].pMonsterInfo.uHP ) + pActors[mon_id].sCurrentHP = pActors[mon_id].pMonsterInfo.uHP; + } + } + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_CURE_POISON://Лечение Отравления(Противоядие) + { + switch (skill_level) + { + case 1: amount = 3600 * spell_level; break; + case 2: amount = 3600 * spell_level; break; + case 3: amount = 86400 * spell_level; break; + case 4: amount = 0; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak] + || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium] + || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] ) + { + if ( skill_level == 4 ) + { + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak] = 0; + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium] = 0; + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] = 0; + LODWORD(v727) = 1; + break; + } + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Weak, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Medium, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Severe, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + } LODWORD(v727) = 1; break; } - case SPELL_MIND_BERSERK: - { - switch (skill_level) - { - case 1: amount = 300 * spell_level; break; - case 2: amount = 300 * spell_level; break; - case 3: amount = 600 * spell_level; break; - case 4: amount = 3600; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v426 = PID_ID(a2); - if (PID_TYPE(a2) != OBJECT_Actor) - { - LODWORD(v727) = 1; - break; - } - v730 = 836 * v426; - if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) - { - pActors[v426].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); - pActors[v426].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); - pActors[v426].pActorBuffs[ACTOR_BUFF_BERSERK].Apply( - pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), - skill_level, 0, 0, 0); - pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - } - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - v61 = v426; - pSpellSprite.uObjectDescID = v60; - pSpellSprite.vPosition.x = pActors[v61].vPosition.x; - pSpellSprite.vPosition.y = pActors[v61].vPosition.y; - pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight; - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z); - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(pSpellSprite.uAttributes) |= 0x80u; - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); - LODWORD(v727) = 1; - break; - } - case SPELL_MIND_ENSLAVE: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - amount = 600 * spell_level; - if (PID_TYPE(a2) != OBJECT_Actor) - { - LODWORD(v727) = 1; - break; - } - v730 = 836 * PID_ID(a2); - if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - break; - if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) - { - pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); - pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); - pActors[PID_ID(a2)].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), - skill_level, 0, 0, 0); - } - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - v61 = PID_ID(a2); - pSpellSprite.uObjectDescID = v60; - pSpellSprite.vPosition.x = pActors[v61].vPosition.x; - pSpellSprite.vPosition.y = pActors[v61].vPosition.y; - pSpellSprite.vPosition.z = pActors[v61].vPosition.z + pActors[v61].uActorHeight; - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = pIndoor->GetSector(pActors[v61].vPosition.x, pActors[v61].vPosition.y, pSpellSprite.vPosition.z); - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(pSpellSprite.uAttributes) |= 0x80u; - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); - LODWORD(v727) = 1; - break; - } - case SPELL_MIND_MASS_FEAR: - { - if ( skill_level == 4 ) - amount = 300 * spell_level; - else - amount = 180 * spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - int _v726 = pRenderer->_46А6АС_GetActorsInViewport(4096); - pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 192); - ++pSpellSprite.uType; - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = 0; - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.field_60_distance_related_prolly_lod = 0; - pSpellSprite.uFacing = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) - { - v433 = &pActors[_50BF30_actors_in_viewport_ids[a2]]; - if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - break; - pSpellSprite.vPosition.x = v433->vPosition.x; - pSpellSprite.vPosition.y = v433->vPosition.y; - pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * -0.8); - - pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); - pSpellSprite.Create(0, 0, 0, 0); - if ( stru_50C198.GetMagicalResistance(v433, 7u) ) - { - v433->pActorBuffs[ACTOR_BUFF_AFRAID].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), - skill_level, 0, 0, 0); - } - } - LODWORD(v727) = 1; - break; - } - case SPELL_MIND_CURE_INSANITY: - { - v435 = skill_level - 2; - if ( skill_level == 4 ) - amount = 0; - else - amount = 86400 * spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - v440 = pCastSpell->uPlayerID_2; - if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) - { - if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) - pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); - if ( skill_level == 4 ) - { - v441 = pCastSpell->uPlayerID_2; - LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; - HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; - } - else - { - pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, - (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); - } - v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v377->SetCondition(1, 0); - } - LODWORD(v727) = 1; - break; - } - case SPELL_EARTH_TELEKINESIS: - { - switch (skill_level) - { - case 1: amount = 2 * spell_level; break; - case 2: amount = 2 * spell_level; break; - case 3: amount = 3 * spell_level; break; - case 4: amount = 4 * spell_level; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v445 = PID_ID(a2); - if (PID_TYPE(a2) == OBJECT_Item) - { - v449 = (char *)&pSpriteObjects[v445].stru_24; - v450 = *(int *)v449; - if ( pItemsTable->pItems[v450].uEquipType == 18 ) - { - pParty->PartyFindsGold(*((int *)v449 + 3), 0); - viewparams->bRedrawGameUI = 1; - } - else - { - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); - ShowStatusBarString(pTmpBuf2.data(), 2u); - if ( !pParty->AddItemToParty(&pSpriteObjects[v445].stru_24) ) - pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24); - } - SpriteObject::OnInteraction(v445); - } - else - { - if (PID_TYPE(a2) == OBJECT_Actor) - { - pActors[v445].LootActor(); - } - else - { - if (PID_TYPE(a2) != OBJECT_Decoration) - { - if (PID_TYPE(a2) != OBJECT_BModel) - { - LODWORD(v727) = 1; - break; - } - OpenedTelekinesis = true; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - v448 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID; - else - v448 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID; - EventProcessor(v448, a2, 1); - LODWORD(v727) = 1; - break; - } - OpenedTelekinesis = true; - if ( pLevelDecorations[v445].uEventID ) - { - EventProcessor(v448, a2, 1); - LODWORD(v727) = 1; - break; - } - if ( pLevelDecorations[v445].IsInteractive() ) - { - activeLevelDecoration = &pLevelDecorations[v445]; - EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1); - activeLevelDecoration = NULL; - } - } - } - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_CURE_WEAKNESS: - { - switch (skill_level) - { - case 1: amount = 180 * spell_level; break; - case 2: amount = 3600 * spell_level; break; - case 3: amount = 86400 * spell_level; break; - case 4: amount = 0; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - v323 = pCastSpell->uPlayerID_2; - v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; - if ( !pParty->pPlayers[v323].pConditions[1] ) - { - LODWORD(v727) = 1; - break; - } - if ( skill_level == 4 ) - { - *(int *)v324 = 0; - *((int *)v324 + 1) = 0; - LODWORD(v727) = 1; - break; - } - v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); - v656 = 1; - v325 = &pParty->pPlayers[v323]; - v325->DiscardConditionIfLastsLongerThan(v656, v663); - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_FIRST_AID: - { - switch (skill_level) - { - case 1: amount = 2 * spell_level + 5; break; - case 2: amount = 3 * spell_level + 5; break; - case 3: amount = 4 * spell_level + 5; break; - case 4: amount = 5 * spell_level + 5; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v460 = pCastSpell->spell_target_pid; - if (!v460) - { - pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - } - else - { - if (PID_TYPE(v460) == OBJECT_Actor) - { - v461 = &pActors[PID_ID(v460)]; - v462 = v461->uAIState; - v463 = v461->pMonsterInfo.uHP; - if ( v462 != 5 ) - { - if ( v462 != 4 ) - { - if ( v462 != 19 ) - { - if ( v462 != 11 ) - { - v461->sCurrentHP += amount; - if ( v461->sCurrentHP > v463 ) - v461->sCurrentHP = v463; - } - } - } - } - } - } - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_CURE_POISON: - { - switch (skill_level) - { - case 1: amount = 3600 * spell_level; break; - case 2: amount = 3600 * spell_level; break; - case 3: amount = 86400 * spell_level; break; - case 4: amount = 0; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - v470 = pCastSpell->uPlayerID_2; - if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) - && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) - && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) - { - LODWORD(v727) = 1; - break; - } - if ( skill_level == 4 ) - { - LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; - HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; - v471 = pCastSpell->uPlayerID_2; - LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; - HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; - v472 = pCastSpell->uPlayerID_2; - LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; - HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; - LODWORD(v727) = 1; - break; - } - *(float *)&a2 = (double)(amount << 7) * 0.033333335; - pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( - 6u, - (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( - 8u, - (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); - v656 = 10; - v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v325->DiscardConditionIfLastsLongerThan(v656, v663); - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_PROTECTION_FROM_MAGIC: - { - amount = spell_level; - LODWORD(v733) = 3600 * spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); - - pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, spell_level, 0, 0); - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_HAMMERHANDS: - { - LODWORD(v733) = 3600 * spell_level; - amount = spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - if ( skill_level == 4 ) - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); - v732 = (int)v733 << 7; - v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); - pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); - pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); - pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, spell_level, spell_level, 0); - - pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, spell_level, spell_level, 0); - LODWORD(v727) = 1; - break; - } - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - - pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, spell_level, spell_level, 0); - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_CURE_DISEASE: - { - if ( skill_level == 4 ) - amount = 0; - else - amount = 86400 * spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - v498 = pCastSpell->uPlayerID_2; - if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) - && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) - && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) - { - LODWORD(v727) = 1; - break; - } - if ( skill_level == 4 ) - { - LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; - HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; - v499 = pCastSpell->uPlayerID_2; - LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; - HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; - v500 = pCastSpell->uPlayerID_2; - LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; - HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; - } - else - { - *(float *)&a2 = (double)(amount << 7) * 0.033333335; - pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( - 7u, - (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( - 9u, - (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); - v656 = 11; - v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v325->DiscardConditionIfLastsLongerThan(v656, v663); - } - LODWORD(v727) = 1; - break; - } - case SPELL_BODY_POWER_CURE: - { - amount = 5 * spell_level + 10; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v501 = pParty->pPlayers.data(); - int v1 = 0; - do - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, v1); - v501->Heal(amount); - ++v501; - ++v1; - } - while ( (signed int)v501 < (signed int)pParty->pHirelings.data() ); - LODWORD(v727) = 1; - break; - } - case SPELL_LIGHT_DISPEL_MAGIC: - { - sRecoveryTime -= spell_level; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192); - v505 = pRenderer->_46А6АС_GetActorsInViewport(4096); - ++pSpellSprite.uType; - //signed int _v733 = v505; - v688.x = 0; - v688.y = 0; - v688.z = 0; - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = 0; - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.field_60_distance_related_prolly_lod = 0; - pSpellSprite.uFacing = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - a2 = 0; - for ( a2 = 0; a2 < v505; ++a2 ) - { - v507 = _50BF30_actors_in_viewport_ids[a2]; - pSpellSprite.vPosition.x = pActors[v507].vPosition.x; - pSpellSprite.vPosition.y = pActors[v507].vPosition.y; - pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * -0.8); - pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); - v509 = pSpellSprite.Create(0, 0, 0, 0); - DamageMonsterFromParty(PID(OBJECT_Item, v509), _50BF30_actors_in_viewport_ids[a2], &v688); - } - for ( a2 = 0; a2 < v505; ++a2 ) - { - pActor = &pActors[_50BF30_actors_in_viewport_ids[a2]]; - pSpellSprite.vPosition.x = pActor->vPosition.x; - pSpellSprite.vPosition.y = pActor->vPosition.y; - pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * -0.8); - pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); - pSpellSprite.Create(0, 0, 0, 0); - for (int i = 0; i < 22; ++i) - { - pActor->pActorBuffs[i].Reset(); - } - } - LODWORD(v727) = 1; - break; - } - case SPELL_LIGHT_SUMMON_ELEMENTAL: - { - switch (skill_level) - { - case 1: v733 = 300 * spell_level; amount = 1; break; - case 2: v733 = 300 * spell_level; amount = 1; break; - case 3: v733 = 900 * spell_level; amount = 3; break; - case 4: v733 = 900 * spell_level; amount = 5; break; - default: - assert(false); - } - //v733 = __PAIR__(0, v516); - signed int _v733 = 0; - if ( (signed int)uNumActors > 0 ) - { - v518 = pActors.data();//[0].uAIState; - size_t _v726 = uNumActors; - do - { - v519 = v518->uAIState; - if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) - ++_v733; - ++v518; - --_v726; - } - while ( _v726 != 0 ); - } - if ( _v733 >= amount ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, skill_level, v733); - LODWORD(v727) = 1; - break; - } - case SPELL_LIGHT_DAY_OF_THE_GODS: - { - switch (skill_level) - { - case 1: LODWORD(v733) = 10800 * spell_level; amount = 3 * spell_level + 10; break; - case 2: LODWORD(v733) = 10800 * spell_level; amount = 3 * spell_level + 10; break; - case 3: LODWORD(v733) = 14400 * spell_level; amount = 4 * spell_level + 10; break; - case 4: LODWORD(v733) = 18000 * spell_level; amount = 5 * spell_level + 10; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); - - pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); - LODWORD(v727) = 1; - break; - } - case SPELL_LIGHT_PRISMATIC_LIGHT: - { - //v67 = 2; - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v531 = pRenderer->_46А6АС_GetActorsInViewport(4096); - ++pSpellSprite.uType; - v694.x = 0; - v694.y = 0; - v694.z = 0; - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = 0; - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.field_60_distance_related_prolly_lod = 0; - pSpellSprite.uFacing = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - a2 = 0; + case SPELL_BODY_PROTECTION_FROM_MAGIC://Защита от магии + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); + pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + + (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, 0, 0); + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_HAMMERHANDS://Руки-Молоты + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if ( skill_level == 4 ) + { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); + for ( uint pl_id = 0; pl_id < 4; pl_id++) + pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + + (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), 4, spell_level, spell_level, 0); + LODWORD(v727) = 1; + break; + } + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + + (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, spell_level, 0); + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_CURE_DISEASE://Лечить Болезнь + { + if ( skill_level == 4 ) + amount = 0; + else + amount = 86400 * spell_level; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Weak] + || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Medium] + || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Severe] ) + { + if ( skill_level == 4 ) + { + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Weak] = 0; + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Medium] = 0; + pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Severe] = 0; + } + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Weak, + (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Medium, + (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Severe, + (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); + } + LODWORD(v727) = 1; + break; + } + case SPELL_BODY_POWER_CURE://Исцеление + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + for ( uint pl_id = 0; pl_id < 4; ++pl_id ) + { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); + pParty->pPlayers[pl_id].Heal(5 * spell_level + 10); + } + LODWORD(v727) = 1; + break; + } + case SPELL_LIGHT_DISPEL_MAGIC://Снятие чар + { + sRecoveryTime -= spell_level; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192); + int mon_num = pRenderer->_46А6АС_GetActorsInViewport(4096); + ++pSpellSprite.uType; + v688.x = 0; + v688.y = 0; + v688.z = 0; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + for ( a2 = 0; a2 < mon_num; ++a2 ) + { + pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x; + pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y; + pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - + (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); + DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[a2], &v688); + } + for ( a2 = 0; a2 < mon_num; ++a2 ) + { + pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.x; + pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.y; + pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[a2]].vPosition.z - + (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[a2]].uActorHeight * -0.8); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); + pSpellSprite.Create(0, 0, 0, 0); + for (int i = 0; i < 22; ++i) + pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[i].Reset(); + } + LODWORD(v727) = 1; + break; + } + case SPELL_LIGHT_SUMMON_ELEMENTAL://Элементал + { + switch (skill_level) + { + case 1: v733 = 300 * spell_level; amount = 1; break; + case 2: v733 = 300 * spell_level; amount = 1; break; + case 3: v733 = 900 * spell_level; amount = 3; break; + case 4: v733 = 900 * spell_level; amount = 5; break; + default: + assert(false); + } + int mon_num = 0; + for ( uint mon_id = 0; mon_id < uNumActors; mon_id++ ) + { + if ( pActors[mon_id].uAIState != Dead && pActors[mon_id].uAIState != Removed && pActors[mon_id].uAIState != Disabled + && PID(OBJECT_Player, pCastSpell->uPlayerID) == pActors[mon_id].uSummonerID ) + ++mon_num; + } + if ( mon_num >= amount ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, skill_level, v733); + LODWORD(v727) = 1; + break; + } + case SPELL_LIGHT_DAY_OF_THE_GODS://День богов + { + switch (skill_level) + { + case 1: duration = 10800 * spell_level; amount = 3 * spell_level + 10; break; + case 2: duration = 10800 * spell_level; amount = 3 * spell_level + 10; break; + case 3: duration = 14400 * spell_level; amount = 4 * spell_level + 10; break; + case 4: duration = 18000 * spell_level; amount = 5 * spell_level + 10; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); + pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); + LODWORD(v727) = 1; + break; + } + case SPELL_LIGHT_PRISMATIC_LIGHT://Свет призмы + { + //v67 = 2; + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + v531 = pRenderer->_46А6АС_GetActorsInViewport(4096); + ++pSpellSprite.uType; + v694.x = 0; + v694.y = 0; + v694.z = 0; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + a2 = 0; if ( (signed int)v531 > 0 ) { do