annotate Engine/Objects/Player.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
rev   line source
2498
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7 #include "Engine/Engine.h"
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
8 #include "Engine/stru6.h"
2498
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10 #include "Player.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
11 #include "../Tables/PlayerFrameTable.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
12 #include "Media/Audio/AudioPlayer.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
13 #include "../Party.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
14 #include "../LOD.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
15 #include "GUI/GUIWindow.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
16 #include "../Graphics/Viewport.h"
2498
Ritor1
parents:
diff changeset
17 #include "Actor.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
18 #include "IO/Mouse.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
19 #include "../TurnEngine/TurnEngine.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
20 #include "../Events.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
21 #include "../Events2D.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
22 #include "../Graphics/Outdoor.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
23 #include "../Tables/StorylineTextTable.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
24 #include "../Autonotes.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
25 #include "../Awards.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
26 #include "../texts.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
27
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
28 #include "../stru123.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
29 #include "../stru298.h"
2498
Ritor1
parents:
diff changeset
30 #include "ObjectList.h"
Ritor1
parents:
diff changeset
31 #include "SpriteObject.h"
2499
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
32 #include "../Graphics/DecalBuilder.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
33 #include "../Spells/CastSpellInfo.h"
68cdef6879a0 engine folder
Ritor1
parents: 2498
diff changeset
34 #include "../OurMath.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
35 #include "..\..\GUI\UI\UIPartyCreation.h"
2498
Ritor1
parents:
diff changeset
36
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39
Ritor1
parents:
diff changeset
40 NZIArray<struct Player *, 5> pPlayers;
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43 /* 381 */
Ritor1
parents:
diff changeset
44 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
45 struct PlayerCreation_AttributeProps
Ritor1
parents:
diff changeset
46 {
Ritor1
parents:
diff changeset
47 unsigned __int8 uBaseValue;
Ritor1
parents:
diff changeset
48 char uMaxValue;
Ritor1
parents:
diff changeset
49 char uDroppedStep;
Ritor1
parents:
diff changeset
50 char uBaseStep;
Ritor1
parents:
diff changeset
51 };
Ritor1
parents:
diff changeset
52 #pragma pack(pop)
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54
Ritor1
parents:
diff changeset
55 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
56
Ritor1
parents:
diff changeset
57
Ritor1
parents:
diff changeset
58
Ritor1
parents:
diff changeset
59 #pragma pack(pop)
Ritor1
parents:
diff changeset
60 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0
Ritor1
parents:
diff changeset
61 {
Ritor1
parents:
diff changeset
62 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},},
Ritor1
parents:
diff changeset
63 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},},
Ritor1
parents:
diff changeset
64 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},},
Ritor1
parents:
diff changeset
65 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}}
Ritor1
parents:
diff changeset
66 };
Ritor1
parents:
diff changeset
67
Ritor1
parents:
diff changeset
68
Ritor1
parents:
diff changeset
69
Ritor1
parents:
diff changeset
70 std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; //dword_4EDEA0 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one
Ritor1
parents:
diff changeset
71 std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100, 200}; //dword_4EDEB4
Ritor1
parents:
diff changeset
72 std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; //dword_4EDEC4 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one
Ritor1
parents:
diff changeset
73
Ritor1
parents:
diff changeset
74
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76 // available skills per class ( 9 classes X 37 skills )
Ritor1
parents:
diff changeset
77 // 0 - not available
Ritor1
parents:
diff changeset
78 // 1 - available
Ritor1
parents:
diff changeset
79 // 2 - primary skill
Ritor1
parents:
diff changeset
80 unsigned char pSkillAvailabilityPerClass[9][37] = // byte[] @ MM7.exe::004ED820
Ritor1
parents:
diff changeset
81 {
Ritor1
parents:
diff changeset
82 {0, 2, 0, 1, 1, 1, 1, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
Ritor1
parents:
diff changeset
83 {0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 1, 0},
Ritor1
parents:
diff changeset
84 {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1, 0, 0, 0},
Ritor1
parents:
diff changeset
85 {0, 1, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
Ritor1
parents:
diff changeset
86 {0, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
Ritor1
parents:
diff changeset
87 {0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0},
Ritor1
parents:
diff changeset
88 {0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
Ritor1
parents:
diff changeset
89 {0, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
Ritor1
parents:
diff changeset
90 {2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0} // some of these are started at 4ED94C, but needs to be here
Ritor1
parents:
diff changeset
91 };
Ritor1
parents:
diff changeset
92
Ritor1
parents:
diff changeset
93
Ritor1
parents:
diff changeset
94 unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398
Ritor1
parents:
diff changeset
95 {
Ritor1
parents:
diff changeset
96 1, // EQUIP_SINGLE_HANDED
Ritor1
parents:
diff changeset
97 1, // EQUIP_TWO_HANDED
Ritor1
parents:
diff changeset
98 2, // EQUIP_BOW
Ritor1
parents:
diff changeset
99 3, // EQUIP_ARMOUR
Ritor1
parents:
diff changeset
100 0, // EQUIP_SHIELD
Ritor1
parents:
diff changeset
101 4, // EQUIP_HELMET
Ritor1
parents:
diff changeset
102 5, // EQUIP_BELT
Ritor1
parents:
diff changeset
103 6, // EQUIP_CLOAK
Ritor1
parents:
diff changeset
104 7, // EQUIP_GAUNTLETS
Ritor1
parents:
diff changeset
105 8, // EQUIP_BOOTS
Ritor1
parents:
diff changeset
106 10, // EQUIP_RING
Ritor1
parents:
diff changeset
107 9, // EQUIP_AMULET
Ritor1
parents:
diff changeset
108 1, // EQUIP_WAND
Ritor1
parents:
diff changeset
109 0, // EQUIP_REAGENT
Ritor1
parents:
diff changeset
110 0, // EQUIP_POTION
Ritor1
parents:
diff changeset
111 0, // EQUIP_SPELL_SCROLL
Ritor1
parents:
diff changeset
112 0, // EQUIP_BOOK
Ritor1
parents:
diff changeset
113 0, // EQUIP_MESSAGE_SCROLL
Ritor1
parents:
diff changeset
114 0, // EQUIP_GOLD
Ritor1
parents:
diff changeset
115 0, // EQUIP_GEM
Ritor1
parents:
diff changeset
116 0 // EQUIP_NONE
Ritor1
parents:
diff changeset
117 };
Ritor1
parents:
diff changeset
118
Ritor1
parents:
diff changeset
119
Ritor1
parents:
diff changeset
120 unsigned char pBaseHealthByClass[12] = {40, 35, 35, 30, 30, 30, 25, 20, 20, 0, 0, 0};
Ritor1
parents:
diff changeset
121 unsigned char pBaseManaByClass[12] = { 0, 0, 0, 5, 5, 0, 10, 10, 15, 0, 0, 0};
Ritor1
parents:
diff changeset
122 unsigned char pBaseHealthPerLevelByClass[36] = {5, 7, 9, 9, 4, 6, 8, 8, 5, 6, 8, 8, 4, 5, 6, 6, 3, 4, 6, 6, 4, 5, 6, 6, 2, 3, 4, 4, 2, 3, 4, 4, 2, 3, 3, 3};
Ritor1
parents:
diff changeset
123 unsigned char pBaseManaPerLevelByClass[36] = {0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 2, 3, 3, 1, 2, 3, 3, 0, 2, 3, 3, 3, 4, 5, 5, 3, 4, 5, 5, 3, 4, 6, 6};
Ritor1
parents:
diff changeset
124
Ritor1
parents:
diff changeset
125 unsigned char pConditionAttributeModifier[7][19] =
Ritor1
parents:
diff changeset
126 {{100, 100, 100, 120, 50, 200, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Might
Ritor1
parents:
diff changeset
127 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Intelligence
Ritor1
parents:
diff changeset
128 {100, 100, 100, 50, 25, 10, 100, 100, 75, 60, 50, 30, 100, 100, 100, 100, 100, 1, 100}, //Willpower
Ritor1
parents:
diff changeset
129 {100, 100, 100, 100, 50, 150, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 100, 100}, //Endurance
Ritor1
parents:
diff changeset
130 {100, 100, 100, 50, 10, 100, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Accuracy
Ritor1
parents:
diff changeset
131 {100, 100, 100, 120, 20, 120, 75, 60, 50, 30, 25, 10, 100, 100, 100, 100, 100, 50, 100}, //Speed
Ritor1
parents:
diff changeset
132 {100, 100, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}}; //Luck
Ritor1
parents:
diff changeset
133
Ritor1
parents:
diff changeset
134 unsigned char pAgingAttributeModifier[7][4] =
Ritor1
parents:
diff changeset
135 {{100, 75, 40, 10}, //Might
Ritor1
parents:
diff changeset
136 {100, 150, 100, 10}, //Intelligence
Ritor1
parents:
diff changeset
137 {100, 150, 100, 10}, //Willpower
Ritor1
parents:
diff changeset
138 {100, 75, 40, 10}, //Endurance
Ritor1
parents:
diff changeset
139 {100, 100, 40, 10}, //Accuracy
Ritor1
parents:
diff changeset
140 {100, 100, 40, 10}, //Speed
Ritor1
parents:
diff changeset
141 {100, 100, 100, 100}}; //Luck
Ritor1
parents:
diff changeset
142
Ritor1
parents:
diff changeset
143 unsigned int pAgeingTable[4] = {50, 100, 150, 0xFFFF};
Ritor1
parents:
diff changeset
144
Ritor1
parents:
diff changeset
145 std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}};
Ritor1
parents:
diff changeset
146
Ritor1
parents:
diff changeset
147 short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175,
Ritor1
parents:
diff changeset
148 150, 125, 100, 75, 50, 40, 35, 30, 25, 21,
Ritor1
parents:
diff changeset
149 19, 17, 15, 13, 11, 9, 7, 5, 3, 0};
Ritor1
parents:
diff changeset
150 signed int parameter_to_bonus_value[29] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6};
Ritor1
parents:
diff changeset
151
Ritor1
parents:
diff changeset
152
Ritor1
parents:
diff changeset
153 unsigned short base_recovery_times_per_weapon_type[12] =
Ritor1
parents:
diff changeset
154 {
Ritor1
parents:
diff changeset
155 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill
Ritor1
parents:
diff changeset
156 90, // PLAYER_SKILL_SWORD && Unarmed with skill
Ritor1
parents:
diff changeset
157 60, // PLAYER_SKILL_DAGGER
Ritor1
parents:
diff changeset
158 100, // PLAYER_SKILL_AXE
Ritor1
parents:
diff changeset
159 80, // PLAYER_SKILL_SPEAR
Ritor1
parents:
diff changeset
160 100, // PLAYER_SKILL_BOW
Ritor1
parents:
diff changeset
161 80, // PLAYER_SKILL_MACE
Ritor1
parents:
diff changeset
162 30, // PLAYER_SKILL_BLASTER
Ritor1
parents:
diff changeset
163 10, // PLAYER_SKILL_SHIELD
Ritor1
parents:
diff changeset
164 10, // PLAYER_SKILL_LEATHER
Ritor1
parents:
diff changeset
165 20, // PLAYER_SKILL_CHAIN
Ritor1
parents:
diff changeset
166 30 // PLAYER_SKILL_PLATE
Ritor1
parents:
diff changeset
167 };
Ritor1
parents:
diff changeset
168
Ritor1
parents:
diff changeset
169 //----- (00490913) --------------------------------------------------------
Ritor1
parents:
diff changeset
170 int PlayerCreation_GetUnspentAttributePointCount()
Ritor1
parents:
diff changeset
171 {
Ritor1
parents:
diff changeset
172 signed int v0; // edi@1
Ritor1
parents:
diff changeset
173 int raceId; // ebx@2
Ritor1
parents:
diff changeset
174 signed int v4; // eax@17
Ritor1
parents:
diff changeset
175 int v5; // edx@18
Ritor1
parents:
diff changeset
176 signed int v6; // ecx@18
Ritor1
parents:
diff changeset
177 signed int remainingStatPoints; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
178
Ritor1
parents:
diff changeset
179 remainingStatPoints = 50;
Ritor1
parents:
diff changeset
180 v0 = 50;
Ritor1
parents:
diff changeset
181 for (int playerNum = 0; playerNum < 4; playerNum++)
Ritor1
parents:
diff changeset
182 {
Ritor1
parents:
diff changeset
183 raceId = pParty->pPlayers[playerNum].GetRace();
Ritor1
parents:
diff changeset
184 for (int statNum = 0; statNum <= 6; statNum++)
Ritor1
parents:
diff changeset
185 {
Ritor1
parents:
diff changeset
186 switch ( statNum )
Ritor1
parents:
diff changeset
187 {
Ritor1
parents:
diff changeset
188 case 0:
Ritor1
parents:
diff changeset
189 v0 = pParty->pPlayers[playerNum].uMight;
Ritor1
parents:
diff changeset
190 break;
Ritor1
parents:
diff changeset
191 case 1:
Ritor1
parents:
diff changeset
192 v0 = pParty->pPlayers[playerNum].uIntelligence;
Ritor1
parents:
diff changeset
193 break;
Ritor1
parents:
diff changeset
194 case 2:
Ritor1
parents:
diff changeset
195 v0 = pParty->pPlayers[playerNum].uWillpower;
Ritor1
parents:
diff changeset
196 break;
Ritor1
parents:
diff changeset
197 case 3:
Ritor1
parents:
diff changeset
198 v0 = pParty->pPlayers[playerNum].uEndurance;
Ritor1
parents:
diff changeset
199 break;
Ritor1
parents:
diff changeset
200 case 4:
Ritor1
parents:
diff changeset
201 v0 = pParty->pPlayers[playerNum].uAccuracy;
Ritor1
parents:
diff changeset
202 break;
Ritor1
parents:
diff changeset
203 case 5:
Ritor1
parents:
diff changeset
204 v0 = pParty->pPlayers[playerNum].uSpeed;
Ritor1
parents:
diff changeset
205 break;
Ritor1
parents:
diff changeset
206 case 6:
Ritor1
parents:
diff changeset
207 v0 = pParty->pPlayers[playerNum].uLuck;
Ritor1
parents:
diff changeset
208 break;
Ritor1
parents:
diff changeset
209 }
Ritor1
parents:
diff changeset
210 v4 = StatTable[raceId][statNum].uBaseValue;
Ritor1
parents:
diff changeset
211 if ( v0 >= v4 )
Ritor1
parents:
diff changeset
212 {
Ritor1
parents:
diff changeset
213 v5 = StatTable[raceId][statNum].uDroppedStep;
Ritor1
parents:
diff changeset
214 v6 = StatTable[raceId][statNum].uBaseStep;
Ritor1
parents:
diff changeset
215 }
Ritor1
parents:
diff changeset
216 else
Ritor1
parents:
diff changeset
217 {
Ritor1
parents:
diff changeset
218 v5 = StatTable[raceId][statNum].uBaseStep;
Ritor1
parents:
diff changeset
219 v6 = StatTable[raceId][statNum].uDroppedStep;
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 remainingStatPoints += v5 * (v4 - v0) / v6;
Ritor1
parents:
diff changeset
222 }
Ritor1
parents:
diff changeset
223 }
Ritor1
parents:
diff changeset
224 return remainingStatPoints;
Ritor1
parents:
diff changeset
225 }
Ritor1
parents:
diff changeset
226
Ritor1
parents:
diff changeset
227 //----- (00427730) --------------------------------------------------------
Ritor1
parents:
diff changeset
228 bool Player::CanCastSpell(unsigned int uRequiredMana)
Ritor1
parents:
diff changeset
229 {
Ritor1
parents:
diff changeset
230 if (sMana >= (signed int)uRequiredMana)
Ritor1
parents:
diff changeset
231 {
Ritor1
parents:
diff changeset
232 sMana -= (signed int)uRequiredMana;
Ritor1
parents:
diff changeset
233 return true;
Ritor1
parents:
diff changeset
234 }
Ritor1
parents:
diff changeset
235
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
236 pAudioPlayer->PlaySound(SOUND_spellfail0201, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
237 return false;
Ritor1
parents:
diff changeset
238 }
Ritor1
parents:
diff changeset
239
Ritor1
parents:
diff changeset
240 //----- (004BE2DD) --------------------------------------------------------
Ritor1
parents:
diff changeset
241 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx )
Ritor1
parents:
diff changeset
242 {
Ritor1
parents:
diff changeset
243 float v6; // ST04_4@1
Ritor1
parents:
diff changeset
244 signed int item_value; // eax@1
Ritor1
parents:
diff changeset
245 signed int sell_price; // ebx@1
Ritor1
parents:
diff changeset
246
Ritor1
parents:
diff changeset
247 item_value =pOwnItems[item_index].GetValue();
Ritor1
parents:
diff changeset
248 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier;
Ritor1
parents:
diff changeset
249 sell_price = GetPriceSell(item_value, v6);
Ritor1
parents:
diff changeset
250 if ( pOwnItems[item_index].IsBroken() )
Ritor1
parents:
diff changeset
251 sell_price = 1;
Ritor1
parents:
diff changeset
252 if ( sell_price < 1 )
Ritor1
parents:
diff changeset
253 sell_price = 1;
Ritor1
parents:
diff changeset
254 RemoveItemAtInventoryIndex(inventory_idnx);
Ritor1
parents:
diff changeset
255 Party::SetGold(pParty->uNumGold + sell_price);
Ritor1
parents:
diff changeset
256 }
Ritor1
parents:
diff changeset
257
Ritor1
parents:
diff changeset
258 //----- (0043EEF3) --------------------------------------------------------
Ritor1
parents:
diff changeset
259 bool Player::NothingOrJustBlastersEquipped()
Ritor1
parents:
diff changeset
260 {
Ritor1
parents:
diff changeset
261 signed int item_idx; // esi@1
Ritor1
parents:
diff changeset
262 signed int item_id; // esi@1
Ritor1
parents:
diff changeset
263 for (int i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
264 {
Ritor1
parents:
diff changeset
265 item_idx = pEquipment.pIndices[i];
Ritor1
parents:
diff changeset
266 if (item_idx)
Ritor1
parents:
diff changeset
267 {
Ritor1
parents:
diff changeset
268 item_id = pOwnItems[item_idx - 1].uItemID;
Ritor1
parents:
diff changeset
269 if ( item_id != ITEM_BLASTER && item_id != ITEM_LASER_RIFLE ) //blaster& blaster rifle
Ritor1
parents:
diff changeset
270 return false;
Ritor1
parents:
diff changeset
271 }
Ritor1
parents:
diff changeset
272 }
Ritor1
parents:
diff changeset
273 return true;
Ritor1
parents:
diff changeset
274 }
Ritor1
parents:
diff changeset
275
Ritor1
parents:
diff changeset
276 //----- (004B8040) --------------------------------------------------------
Ritor1
parents:
diff changeset
277 int Player::GetConditionDayOfWeek( unsigned int uCondition )
Ritor1
parents:
diff changeset
278 {
Ritor1
parents:
diff changeset
279 return (unsigned int)(((signed __int64)((double)this->pConditions[uCondition] * 0.234375) / 60 / 60) / 24) % 7 + 1;
Ritor1
parents:
diff changeset
280 }
Ritor1
parents:
diff changeset
281
Ritor1
parents:
diff changeset
282 //----- (004B807C) --------------------------------------------------------
Ritor1
parents:
diff changeset
283 int Player::GetTempleHealCostModifier(float a2)
Ritor1
parents:
diff changeset
284 {
Ritor1
parents:
diff changeset
285 unsigned int conditionIdx; // eax@1
Ritor1
parents:
diff changeset
286 int conditionTimeMultiplier; // esi@1
Ritor1
parents:
diff changeset
287 int v6; // eax@8
Ritor1
parents:
diff changeset
288 signed int result; // qax@13
Ritor1
parents:
diff changeset
289 signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4
Ritor1
parents:
diff changeset
290
Ritor1
parents:
diff changeset
291 conditionIdx = GetMajorConditionIdx();
Ritor1
parents:
diff changeset
292 if ( conditionIdx >= 14 && conditionIdx <= 16)
Ritor1
parents:
diff changeset
293 {
Ritor1
parents:
diff changeset
294 if ( conditionIdx <= 15 )
Ritor1
parents:
diff changeset
295 baseConditionMultiplier = 5;
Ritor1
parents:
diff changeset
296 else //if ( conditionIdx == 16 )
Ritor1
parents:
diff changeset
297 baseConditionMultiplier = 10;
Ritor1
parents:
diff changeset
298 conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx);
Ritor1
parents:
diff changeset
299 }
Ritor1
parents:
diff changeset
300 else
Ritor1
parents:
diff changeset
301 {
Ritor1
parents:
diff changeset
302 conditionTimeMultiplier = 1;
Ritor1
parents:
diff changeset
303 baseConditionMultiplier = 1;
Ritor1
parents:
diff changeset
304 if (conditionIdx < 14)
Ritor1
parents:
diff changeset
305 {
Ritor1
parents:
diff changeset
306 for (int i = 0; i <= 13; i++)
Ritor1
parents:
diff changeset
307 {
Ritor1
parents:
diff changeset
308 v6 = GetConditionDayOfWeek(i);
Ritor1
parents:
diff changeset
309 if ( v6 > conditionTimeMultiplier )
Ritor1
parents:
diff changeset
310 conditionTimeMultiplier = v6;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 }
Ritor1
parents:
diff changeset
313 }
Ritor1
parents:
diff changeset
314 result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2);
Ritor1
parents:
diff changeset
315 if ( result < 1 )
Ritor1
parents:
diff changeset
316 result = 1;
Ritor1
parents:
diff changeset
317 return result;
Ritor1
parents:
diff changeset
318 }
Ritor1
parents:
diff changeset
319
Ritor1
parents:
diff changeset
320 //----- (004B8102) --------------------------------------------------------
Ritor1
parents:
diff changeset
321 int Player::GetPriceSell(int uRealValue, float price_multiplier)
Ritor1
parents:
diff changeset
322 {
Ritor1
parents:
diff changeset
323 signed int v3; // esi@1
Ritor1
parents:
diff changeset
324 signed int result; // eax@3
Ritor1
parents:
diff changeset
325
Ritor1
parents:
diff changeset
326 v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100);
Ritor1
parents:
diff changeset
327 if ( v3 > uRealValue )
Ritor1
parents:
diff changeset
328 v3 = uRealValue;
Ritor1
parents:
diff changeset
329 result = 1;
Ritor1
parents:
diff changeset
330 if ( v3 >= 1 )
Ritor1
parents:
diff changeset
331 result = v3;
Ritor1
parents:
diff changeset
332 return result;
Ritor1
parents:
diff changeset
333 }
Ritor1
parents:
diff changeset
334
Ritor1
parents:
diff changeset
335 //----- (004B8142) --------------------------------------------------------
Ritor1
parents:
diff changeset
336 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
Ritor1
parents:
diff changeset
337 {
Ritor1
parents:
diff changeset
338 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
Ritor1
parents:
diff changeset
339
Ritor1
parents:
diff changeset
340 if (price < uRealValue)
Ritor1
parents:
diff changeset
341 price = uRealValue;
Ritor1
parents:
diff changeset
342 return price;
Ritor1
parents:
diff changeset
343 }
Ritor1
parents:
diff changeset
344
Ritor1
parents:
diff changeset
345 //----- (004B8179) --------------------------------------------------------
Ritor1
parents:
diff changeset
346 int Player::GetPriceIdentification(float a2)
Ritor1
parents:
diff changeset
347 {
Ritor1
parents:
diff changeset
348 signed int v2; // esi@1
Ritor1
parents:
diff changeset
349 int v3; // ecx@1
Ritor1
parents:
diff changeset
350 signed int result; // eax@3
Ritor1
parents:
diff changeset
351
Ritor1
parents:
diff changeset
352 v2 = (signed int)(a2 * 50.0);
Ritor1
parents:
diff changeset
353 v3 = v2 * (100 - GetMerchant()) / 100;
Ritor1
parents:
diff changeset
354 if ( v3 < v2 / 3 )
Ritor1
parents:
diff changeset
355 v3 = v2 / 3;
Ritor1
parents:
diff changeset
356 result = 1;
Ritor1
parents:
diff changeset
357 if ( v3 >= 1 )
Ritor1
parents:
diff changeset
358 result = v3;
Ritor1
parents:
diff changeset
359 return result;
Ritor1
parents:
diff changeset
360 }
Ritor1
parents:
diff changeset
361
Ritor1
parents:
diff changeset
362 //----- (004B81C3) --------------------------------------------------------
Ritor1
parents:
diff changeset
363 int Player::GetPriceRepair(int a2, float a3)
Ritor1
parents:
diff changeset
364 {
Ritor1
parents:
diff changeset
365 signed int v3; // esi@1
Ritor1
parents:
diff changeset
366 int v4; // ecx@1
Ritor1
parents:
diff changeset
367 signed int result; // eax@3
Ritor1
parents:
diff changeset
368
Ritor1
parents:
diff changeset
369 v3 = (signed int)((double)a2 / (6.0 - a3));
Ritor1
parents:
diff changeset
370 v4 = v3 * (100 - GetMerchant()) / 100;
Ritor1
parents:
diff changeset
371 if ( v4 < v3 / 3 )
Ritor1
parents:
diff changeset
372 v4 = v3 / 3;
Ritor1
parents:
diff changeset
373 result = 1;
Ritor1
parents:
diff changeset
374 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
375 result = v4;
Ritor1
parents:
diff changeset
376 return result;
Ritor1
parents:
diff changeset
377 }
Ritor1
parents:
diff changeset
378
Ritor1
parents:
diff changeset
379 //----- (004B8213) --------------------------------------------------------
Ritor1
parents:
diff changeset
380 int Player::GetBaseSellingPrice(int a2, float a3)
Ritor1
parents:
diff changeset
381 {
Ritor1
parents:
diff changeset
382 signed int v3; // qax@1
Ritor1
parents:
diff changeset
383
Ritor1
parents:
diff changeset
384 v3 = (signed int)((double)a2 / (a3 + 2.0));
Ritor1
parents:
diff changeset
385 if ( v3 < 1 )
Ritor1
parents:
diff changeset
386 v3 = 1;
Ritor1
parents:
diff changeset
387 return v3;
Ritor1
parents:
diff changeset
388 }
Ritor1
parents:
diff changeset
389
Ritor1
parents:
diff changeset
390 //----- (004B8233) --------------------------------------------------------
Ritor1
parents:
diff changeset
391 int Player::GetBaseBuyingPrice(int a2, float a3)
Ritor1
parents:
diff changeset
392 {
Ritor1
parents:
diff changeset
393 signed int v3; // qax@1
Ritor1
parents:
diff changeset
394
Ritor1
parents:
diff changeset
395 v3 = (signed int)((double)a2 * a3);
Ritor1
parents:
diff changeset
396 if ( v3 < 1 )
Ritor1
parents:
diff changeset
397 v3 = 1;
Ritor1
parents:
diff changeset
398 return v3;
Ritor1
parents:
diff changeset
399 }
Ritor1
parents:
diff changeset
400
Ritor1
parents:
diff changeset
401 //----- (004B824B) --------------------------------------------------------
Ritor1
parents:
diff changeset
402 int Player::GetBaseIdentifyPrice(float a2)
Ritor1
parents:
diff changeset
403 {
Ritor1
parents:
diff changeset
404 signed int v2; // qax@1
Ritor1
parents:
diff changeset
405
Ritor1
parents:
diff changeset
406 v2 = (signed int)(a2 * 50.0);
Ritor1
parents:
diff changeset
407 if ( v2 < 1 )
Ritor1
parents:
diff changeset
408 v2 = 1;
Ritor1
parents:
diff changeset
409 return v2;
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411
Ritor1
parents:
diff changeset
412 //----- (004B8265) --------------------------------------------------------
Ritor1
parents:
diff changeset
413 int Player::GetBaseRepairPrice(int a2, float a3)
Ritor1
parents:
diff changeset
414 {
Ritor1
parents:
diff changeset
415 signed int v3; // qax@1
Ritor1
parents:
diff changeset
416
Ritor1
parents:
diff changeset
417 v3 = (signed int)((double)a2 / (6.0 - a3));
Ritor1
parents:
diff changeset
418 if ( v3 < 1 )
Ritor1
parents:
diff changeset
419 v3 = 1;
Ritor1
parents:
diff changeset
420 return v3;
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 //----- (004B6FF9) --------------------------------------------------------
Ritor1
parents:
diff changeset
424 bool Player::IsPlayerHealableByTemple()
Ritor1
parents:
diff changeset
425 {
Ritor1
parents:
diff changeset
426 if (this->sHealth >= GetMaxHealth() && this->sMana >= GetMaxMana() && GetMajorConditionIdx() == Condition_Good)
Ritor1
parents:
diff changeset
427 return false;
Ritor1
parents:
diff changeset
428 else
Ritor1
parents:
diff changeset
429 {
Ritor1
parents:
diff changeset
430 if (GetMajorConditionIdx() == Condition_Zombie)
Ritor1
parents:
diff changeset
431 {
Ritor1
parents:
diff changeset
432 if (((signed int)window_SpeakInHouse->ptr_1C == 78 || (signed int)window_SpeakInHouse->ptr_1C == 81 || (signed int)window_SpeakInHouse->ptr_1C == 82))
Ritor1
parents:
diff changeset
433 return false;
Ritor1
parents:
diff changeset
434 else
Ritor1
parents:
diff changeset
435 return true;
Ritor1
parents:
diff changeset
436 }
Ritor1
parents:
diff changeset
437 else
Ritor1
parents:
diff changeset
438 return true;
Ritor1
parents:
diff changeset
439 }
Ritor1
parents:
diff changeset
440 }
Ritor1
parents:
diff changeset
441
Ritor1
parents:
diff changeset
442 //----- (00421E75) --------------------------------------------------------
Ritor1
parents:
diff changeset
443 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index)
Ritor1
parents:
diff changeset
444 {
Ritor1
parents:
diff changeset
445 int item_idx; // eax@1
Ritor1
parents:
diff changeset
446 int inv_index; // eax@3
Ritor1
parents:
diff changeset
447
Ritor1
parents:
diff changeset
448 item_idx = *pitem_index;
Ritor1
parents:
diff changeset
449 if ( item_idx >125 || item_idx < 0 )
Ritor1
parents:
diff changeset
450 return 0;
Ritor1
parents:
diff changeset
451 inv_index = this->pInventoryMatrix[item_idx];
Ritor1
parents:
diff changeset
452 if ( inv_index < 0 )
Ritor1
parents:
diff changeset
453 {
Ritor1
parents:
diff changeset
454 *pitem_index = -1 - inv_index;
Ritor1
parents:
diff changeset
455 inv_index = this->pInventoryMatrix[-1 - inv_index];
Ritor1
parents:
diff changeset
456 }
Ritor1
parents:
diff changeset
457 return inv_index;
Ritor1
parents:
diff changeset
458 }
Ritor1
parents:
diff changeset
459
Ritor1
parents:
diff changeset
460 //----- (004160CA) --------------------------------------------------------
Ritor1
parents:
diff changeset
461 void Player::ItemsEnchant( int enchant_count )
Ritor1
parents:
diff changeset
462 {
Ritor1
parents:
diff changeset
463 int avalible_items; // ebx@1
Ritor1
parents:
diff changeset
464 int i; // edx@8
Ritor1
parents:
diff changeset
465 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1
Ritor1
parents:
diff changeset
466
Ritor1
parents:
diff changeset
467 avalible_items = 0;
Ritor1
parents:
diff changeset
468 memset (item_index_tabl,0,sizeof(item_index_tabl));
Ritor1
parents:
diff changeset
469
Ritor1
parents:
diff changeset
470 for (i = 0; i < 138; ++i)
Ritor1
parents:
diff changeset
471 {
Ritor1
parents:
diff changeset
472 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID <= 134))
Ritor1
parents:
diff changeset
473 item_index_tabl[avalible_items++] = i;
Ritor1
parents:
diff changeset
474 }
Ritor1
parents:
diff changeset
475
Ritor1
parents:
diff changeset
476 if ( avalible_items )
Ritor1
parents:
diff changeset
477 {
Ritor1
parents:
diff changeset
478 if ( enchant_count )
Ritor1
parents:
diff changeset
479 {
Ritor1
parents:
diff changeset
480 for ( i = 0; i < enchant_count; ++i )
Ritor1
parents:
diff changeset
481 {
Ritor1
parents:
diff changeset
482 if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_HARDENED))
Ritor1
parents:
diff changeset
483 pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_HARDENED;
Ritor1
parents:
diff changeset
484 }
Ritor1
parents:
diff changeset
485 }
Ritor1
parents:
diff changeset
486 else
Ritor1
parents:
diff changeset
487 {
Ritor1
parents:
diff changeset
488 for ( i = 0; i < avalible_items; ++i )
Ritor1
parents:
diff changeset
489 {
Ritor1
parents:
diff changeset
490 pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_HARDENED;
Ritor1
parents:
diff changeset
491 }
Ritor1
parents:
diff changeset
492 }
Ritor1
parents:
diff changeset
493 }
Ritor1
parents:
diff changeset
494 }
Ritor1
parents:
diff changeset
495
Ritor1
parents:
diff changeset
496 //----- (004948B1) --------------------------------------------------------
Ritor1
parents:
diff changeset
497 void Player::PlaySound(PlayerSpeech speech, int a3)
Ritor1
parents:
diff changeset
498 {
Ritor1
parents:
diff changeset
499 signed int speechCount = 0; // esi@4
Ritor1
parents:
diff changeset
500 signed int expressionCount = 0; // esi@4
Ritor1
parents:
diff changeset
501 int pickedVariant; // esi@10
Ritor1
parents:
diff changeset
502 CHARACTER_EXPRESSION_ID expression; // ebx@17
Ritor1
parents:
diff changeset
503 signed int pSoundID; // ecx@19
Ritor1
parents:
diff changeset
504 int speechVariantArray[5]; // [sp+Ch] [bp-1Ch]@7
Ritor1
parents:
diff changeset
505 int expressionVariantArray[5];
Ritor1
parents:
diff changeset
506 unsigned int pickedSoundID; // [sp+30h] [bp+8h]@4
Ritor1
parents:
diff changeset
507 unsigned int expressionDuration = 0;
Ritor1
parents:
diff changeset
508
Ritor1
parents:
diff changeset
509 pickedSoundID = 0;
Ritor1
parents:
diff changeset
510 if (uVoicesVolumeMultiplier)
Ritor1
parents:
diff changeset
511 {
Ritor1
parents:
diff changeset
512 for (int i = 0; i < 2; i++)
Ritor1
parents:
diff changeset
513 {
Ritor1
parents:
diff changeset
514 if ( SoundSetAction[speech][i] )
Ritor1
parents:
diff changeset
515 {
Ritor1
parents:
diff changeset
516 speechVariantArray[speechCount] = SoundSetAction[speech][i];
Ritor1
parents:
diff changeset
517 speechCount++;
Ritor1
parents:
diff changeset
518 }
Ritor1
parents:
diff changeset
519 }
Ritor1
parents:
diff changeset
520 if ( speechCount )
Ritor1
parents:
diff changeset
521 {
Ritor1
parents:
diff changeset
522 pickedVariant = speechVariantArray[rand() % speechCount];
Ritor1
parents:
diff changeset
523 int numberOfSubvariants = byte_4ECF08[pickedVariant - 1][uVoiceID];
Ritor1
parents:
diff changeset
524 if (numberOfSubvariants > 0)
Ritor1
parents:
diff changeset
525 {
Ritor1
parents:
diff changeset
526 pickedSoundID = rand() % numberOfSubvariants + 2 * (pickedVariant + 50 * uVoiceID) + 4998;
Ritor1
parents:
diff changeset
527 pAudioPlayer->PlaySound((SoundID)pickedSoundID, PID(OBJECT_Player, uActiveCharacter + 39), 0, -1, 0, 0, (int)(pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f), 0);
Ritor1
parents:
diff changeset
528 }
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531
Ritor1
parents:
diff changeset
532 for (int i = 0; i < 5; i++)
Ritor1
parents:
diff changeset
533 {
Ritor1
parents:
diff changeset
534 if ( SoundSetAction[speech][i + 3] )
Ritor1
parents:
diff changeset
535 {
Ritor1
parents:
diff changeset
536 expressionVariantArray[expressionCount] = SoundSetAction[speech][i + 3];
Ritor1
parents:
diff changeset
537 expressionCount++;
Ritor1
parents:
diff changeset
538 }
Ritor1
parents:
diff changeset
539 }
Ritor1
parents:
diff changeset
540 if ( expressionCount )
Ritor1
parents:
diff changeset
541 {
Ritor1
parents:
diff changeset
542 expression = (CHARACTER_EXPRESSION_ID)expressionVariantArray[rand() % expressionCount];
Ritor1
parents:
diff changeset
543 if (expression == CHARACTER_EXPRESSION_21 && pickedSoundID )
Ritor1
parents:
diff changeset
544 {
Ritor1
parents:
diff changeset
545 pSoundID = 0;
Ritor1
parents:
diff changeset
546 if ( pSoundList->sNumSounds )
Ritor1
parents:
diff changeset
547 {
Ritor1
parents:
diff changeset
548 for (int i = 0; i < pSoundList->sNumSounds; i++)
Ritor1
parents:
diff changeset
549 {
Ritor1
parents:
diff changeset
550 if (pSoundList->pSL_Sounds[i].uSoundID == pickedSoundID)
Ritor1
parents:
diff changeset
551 pSoundID = i;
Ritor1
parents:
diff changeset
552 }
Ritor1
parents:
diff changeset
553 }
Ritor1
parents:
diff changeset
554 if ( pSoundList->pSL_Sounds[pSoundID].pSoundData[0] )
Ritor1
parents:
diff changeset
555 expressionDuration = (sLastTrackLengthMS << 7) / 1000;
Ritor1
parents:
diff changeset
556 }
Ritor1
parents:
diff changeset
557 PlayEmotion(expression, expressionDuration);
Ritor1
parents:
diff changeset
558 }
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560 // 4948B1: using guessed type int var_1C[5];
Ritor1
parents:
diff changeset
561
Ritor1
parents:
diff changeset
562 //----- (00494A25) --------------------------------------------------------
Ritor1
parents:
diff changeset
563 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3)
Ritor1
parents:
diff changeset
564 {
Ritor1
parents:
diff changeset
565 unsigned int v3 = expression;
Ritor1
parents:
diff changeset
566 if (expression == CHARACTER_EXPRESSION_DEAD || expression == CHARACTER_EXPRESSION_ERADICATED)
Ritor1
parents:
diff changeset
567 {
Ritor1
parents:
diff changeset
568 return;
Ritor1
parents:
diff changeset
569 }
Ritor1
parents:
diff changeset
570 else if (expression == CHARACTER_EXPRESSION_PERTIFIED && new_expression != CHARACTER_EXPRESSION_FALLING)
Ritor1
parents:
diff changeset
571 {
Ritor1
parents:
diff changeset
572 return;
Ritor1
parents:
diff changeset
573 }
Ritor1
parents:
diff changeset
574 else
Ritor1
parents:
diff changeset
575 {
Ritor1
parents:
diff changeset
576 if (expression != CHARACTER_EXPRESSION_SLEEP || new_expression != CHARACTER_EXPRESSION_FALLING)
Ritor1
parents:
diff changeset
577 {
Ritor1
parents:
diff changeset
578 if (v3 >= 2 && v3 <= 11 && v3 != 8 && !(new_expression == CHARACTER_EXPRESSION_DMGRECVD_MINOR || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MODERATE || new_expression == CHARACTER_EXPRESSION_DMGRECVD_MAJOR))
Ritor1
parents:
diff changeset
579 {
Ritor1
parents:
diff changeset
580 return;
Ritor1
parents:
diff changeset
581 }
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 this->uExpressionTimePassed = 0;
Ritor1
parents:
diff changeset
585 if ( !a3 )
Ritor1
parents:
diff changeset
586 {
Ritor1
parents:
diff changeset
587 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength;
Ritor1
parents:
diff changeset
588 }
Ritor1
parents:
diff changeset
589 else
Ritor1
parents:
diff changeset
590 {
Ritor1
parents:
diff changeset
591 this->uExpressionTimeLength = 0;
Ritor1
parents:
diff changeset
592 }
Ritor1
parents:
diff changeset
593 expression = new_expression;
Ritor1
parents:
diff changeset
594 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
595 }
Ritor1
parents:
diff changeset
596
Ritor1
parents:
diff changeset
597 //----- (0049327B) --------------------------------------------------------
Ritor1
parents:
diff changeset
598 bool Player::ProfessionOrGuildFlagsCorrect( unsigned int uClass, int a3 )
Ritor1
parents:
diff changeset
599 {
Ritor1
parents:
diff changeset
600 if ( this->classType == uClass )
Ritor1
parents:
diff changeset
601 {
Ritor1
parents:
diff changeset
602 return true;
Ritor1
parents:
diff changeset
603 }
Ritor1
parents:
diff changeset
604 else
Ritor1
parents:
diff changeset
605 {
Ritor1
parents:
diff changeset
606 if (!a3)
Ritor1
parents:
diff changeset
607 {
Ritor1
parents:
diff changeset
608 return false;
Ritor1
parents:
diff changeset
609 }
Ritor1
parents:
diff changeset
610 switch ( uClass )
Ritor1
parents:
diff changeset
611 {
Ritor1
parents:
diff changeset
612 case 0x1Au:
Ritor1
parents:
diff changeset
613 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 65));
Ritor1
parents:
diff changeset
614 case 0x1Bu:
Ritor1
parents:
diff changeset
615 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 67));
Ritor1
parents:
diff changeset
616 case 0x22u:
Ritor1
parents:
diff changeset
617 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77));
Ritor1
parents:
diff changeset
618 case 0x23u:
Ritor1
parents:
diff changeset
619 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79));
Ritor1
parents:
diff changeset
620 break;
Ritor1
parents:
diff changeset
621 default:
Ritor1
parents:
diff changeset
622 Error("Should not be able to get here (%u)", uClass);
Ritor1
parents:
diff changeset
623 break;
Ritor1
parents:
diff changeset
624 }
Ritor1
parents:
diff changeset
625 return false;
Ritor1
parents:
diff changeset
626 }
Ritor1
parents:
diff changeset
627 }
Ritor1
parents:
diff changeset
628
Ritor1
parents:
diff changeset
629
Ritor1
parents:
diff changeset
630 //----- (00492C0B) --------------------------------------------------------
Ritor1
parents:
diff changeset
631 bool Player::CanAct()
Ritor1
parents:
diff changeset
632 {
Ritor1
parents:
diff changeset
633 if ( this->IsAsleep() || this->IsParalyzed() ||
Ritor1
parents:
diff changeset
634 this->IsUnconcious() || this->IsDead() ||
Ritor1
parents:
diff changeset
635 this->IsPertified() || this->IsEradicated() )
Ritor1
parents:
diff changeset
636 return false;
Ritor1
parents:
diff changeset
637 else
Ritor1
parents:
diff changeset
638 return true;
Ritor1
parents:
diff changeset
639 }
Ritor1
parents:
diff changeset
640
Ritor1
parents:
diff changeset
641 //----- (00492C40) --------------------------------------------------------
Ritor1
parents:
diff changeset
642 bool Player::CanSteal()
Ritor1
parents:
diff changeset
643 {
Ritor1
parents:
diff changeset
644 return GetActualSkillLevel(PLAYER_SKILL_STEALING) != 0;
Ritor1
parents:
diff changeset
645 }
Ritor1
parents:
diff changeset
646
Ritor1
parents:
diff changeset
647 //----- (00492C4E) --------------------------------------------------------
Ritor1
parents:
diff changeset
648 bool Player::CanEquip_RaceAndAlignmentCheck(unsigned int uItemID)
Ritor1
parents:
diff changeset
649 {
Ritor1
parents:
diff changeset
650 switch (uItemID)
Ritor1
parents:
diff changeset
651 {
Ritor1
parents:
diff changeset
652 case ITEM_RELIC_ETHRICS_STAFF:
Ritor1
parents:
diff changeset
653 case ITEM_RELIC_OLD_NICK:
Ritor1
parents:
diff changeset
654 case ITEM_RELIC_TWILIGHT: return pParty->IsPartyEvil(); break;
Ritor1
parents:
diff changeset
655 case ITEM_RELIC_TALEDONS_HELM:
Ritor1
parents:
diff changeset
656 case ITEM_RELIC_JUSTICE: return pParty->IsPartyGood(); break;
Ritor1
parents:
diff changeset
657 case ITEM_ARTIFACT_ELFBANE: return IsRaceGoblin(); break;
Ritor1
parents:
diff changeset
658 case ITEM_ARTIFACT_MINDS_EYE: return IsRaceHuman(); break;
Ritor1
parents:
diff changeset
659 case ITEM_ELVEN_CHAINMAIL: return IsRaceElf(); break;
Ritor1
parents:
diff changeset
660 case ITEM_FORGE_GAUNTLETS: return IsRaceDwarf(); break;
Ritor1
parents:
diff changeset
661 case ITEM_ARTIFACT_HEROS_BELT: return IsMale(); break;
Ritor1
parents:
diff changeset
662 case ITEM_ARTIFACT_LADYS_ESCORT: return IsFemale(); break;
Ritor1
parents:
diff changeset
663 case ITEM_WETSUIT: return NothingOrJustBlastersEquipped(); break;
Ritor1
parents:
diff changeset
664 default: return 1; break;
Ritor1
parents:
diff changeset
665 }
Ritor1
parents:
diff changeset
666 }
Ritor1
parents:
diff changeset
667
Ritor1
parents:
diff changeset
668 //----- (00492D65) --------------------------------------------------------
Ritor1
parents:
diff changeset
669 void Player::SetCondition( unsigned int uConditionIdx, int a3 )
Ritor1
parents:
diff changeset
670 {
Ritor1
parents:
diff changeset
671 signed int player_sex; // ecx@77
Ritor1
parents:
diff changeset
672 signed int remainig_player; // ebx@82
Ritor1
parents:
diff changeset
673 int players_before; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
674 int players_after; // [sp+20h] [bp+Ch]@82
Ritor1
parents:
diff changeset
675
Ritor1
parents:
diff changeset
676 if ( pConditions[uConditionIdx] )
Ritor1
parents:
diff changeset
677 return;
Ritor1
parents:
diff changeset
678
Ritor1
parents:
diff changeset
679 if (!ConditionProcessor::IsPlayerAffected(this, uConditionIdx, a3))
Ritor1
parents:
diff changeset
680 {
Ritor1
parents:
diff changeset
681 return;
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683
Ritor1
parents:
diff changeset
684 switch ( uConditionIdx )
Ritor1
parents:
diff changeset
685 {
Ritor1
parents:
diff changeset
686 case Condition_Cursed: PlaySound(SPEECH_30, 0); break;
Ritor1
parents:
diff changeset
687 case Condition_Weak: PlaySound(SPEECH_25, 0); break;
Ritor1
parents:
diff changeset
688 case Condition_Sleep: break; //nosound
Ritor1
parents:
diff changeset
689 case Condition_Fear: PlaySound(SPEECH_26, 0); break;
Ritor1
parents:
diff changeset
690 case Condition_Drunk: PlaySound(SPEECH_31, 0); break;
Ritor1
parents:
diff changeset
691 case Condition_Insane: PlaySound(SPEECH_29, 0); break;
Ritor1
parents:
diff changeset
692 case Condition_Poison_Weak:
Ritor1
parents:
diff changeset
693 case Condition_Poison_Medium:
Ritor1
parents:
diff changeset
694 case Condition_Poison_Severe: PlaySound(SPEECH_27, 0); break;
Ritor1
parents:
diff changeset
695 case Condition_Disease_Weak:
Ritor1
parents:
diff changeset
696 case Condition_Disease_Medium:
Ritor1
parents:
diff changeset
697 case Condition_Disease_Severe: PlaySound(SPEECH_28, 0);break;
Ritor1
parents:
diff changeset
698 case Condition_Paralyzed: break; //nosound
Ritor1
parents:
diff changeset
699 case Condition_Unconcious:
Ritor1
parents:
diff changeset
700 PlaySound(SPEECH_32, 0);
Ritor1
parents:
diff changeset
701 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
702 sHealth = 0;
Ritor1
parents:
diff changeset
703 break;
Ritor1
parents:
diff changeset
704 case Condition_Dead:
Ritor1
parents:
diff changeset
705 PlaySound(SPEECH_33, 0);
Ritor1
parents:
diff changeset
706 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
707 sHealth = 0;
Ritor1
parents:
diff changeset
708 if ( sMana > 0 )
Ritor1
parents:
diff changeset
709 sMana = 0;
Ritor1
parents:
diff changeset
710 break;
Ritor1
parents:
diff changeset
711 case Condition_Pertified:
Ritor1
parents:
diff changeset
712 PlaySound(SPEECH_34, 0);
Ritor1
parents:
diff changeset
713 break;
Ritor1
parents:
diff changeset
714 case Condition_Eradicated:
Ritor1
parents:
diff changeset
715 PlaySound(SPEECH_35, 0);
Ritor1
parents:
diff changeset
716 if (sHealth > 0 )
Ritor1
parents:
diff changeset
717 sHealth = 0;
Ritor1
parents:
diff changeset
718 if ( sMana > 0 )
Ritor1
parents:
diff changeset
719 sMana = 0;
Ritor1
parents:
diff changeset
720 break;
Ritor1
parents:
diff changeset
721 case Condition_Zombie:
Ritor1
parents:
diff changeset
722 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead())
Ritor1
parents:
diff changeset
723 return;
Ritor1
parents:
diff changeset
724 pConditions.fill(0);
Ritor1
parents:
diff changeset
725 sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
726 sMana = 0;
Ritor1
parents:
diff changeset
727 player_sex = 0;
Ritor1
parents:
diff changeset
728 uPrevFace = uCurrentFace;
Ritor1
parents:
diff changeset
729 uPrevVoiceID = uVoiceID;
Ritor1
parents:
diff changeset
730 if (IsMale())
Ritor1
parents:
diff changeset
731 {
Ritor1
parents:
diff changeset
732 uCurrentFace = 23;
Ritor1
parents:
diff changeset
733 uVoiceID = 23;
Ritor1
parents:
diff changeset
734 }
Ritor1
parents:
diff changeset
735 else
Ritor1
parents:
diff changeset
736 {
Ritor1
parents:
diff changeset
737 uCurrentFace = 24;
Ritor1
parents:
diff changeset
738 uVoiceID = 24;
Ritor1
parents:
diff changeset
739 }
Ritor1
parents:
diff changeset
740 PlaySound(SPEECH_99, 0);
Ritor1
parents:
diff changeset
741 break;
Ritor1
parents:
diff changeset
742 }
Ritor1
parents:
diff changeset
743
Ritor1
parents:
diff changeset
744 players_before = 0;
Ritor1
parents:
diff changeset
745 for (int i = 1; i < 5; ++i)
Ritor1
parents:
diff changeset
746 {
Ritor1
parents:
diff changeset
747 if ( pPlayers[i]->CanAct() )
Ritor1
parents:
diff changeset
748 ++players_before;
Ritor1
parents:
diff changeset
749 }
Ritor1
parents:
diff changeset
750
Ritor1
parents:
diff changeset
751 pConditions[uConditionIdx] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
752
Ritor1
parents:
diff changeset
753 remainig_player = 0;
Ritor1
parents:
diff changeset
754 players_after = 0;
Ritor1
parents:
diff changeset
755 for (int i = 1; i < 5; ++i)
Ritor1
parents:
diff changeset
756 {
Ritor1
parents:
diff changeset
757 if ( pPlayers[i]->CanAct() )
Ritor1
parents:
diff changeset
758 {
Ritor1
parents:
diff changeset
759 remainig_player = i;
Ritor1
parents:
diff changeset
760 ++players_after;
Ritor1
parents:
diff changeset
761 }
Ritor1
parents:
diff changeset
762 }
Ritor1
parents:
diff changeset
763 if (( players_before == 2 ) && ( players_after == 1 ))
Ritor1
parents:
diff changeset
764 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);//ñêîðåå âñåãî îáíàä¸æûâàþùèé âîçãëàñ ïîñëåäíåãî
Ritor1
parents:
diff changeset
765 return;
Ritor1
parents:
diff changeset
766 }
Ritor1
parents:
diff changeset
767
Ritor1
parents:
diff changeset
768 //----- (00492528) --------------------------------------------------------
Ritor1
parents:
diff changeset
769 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
Ritor1
parents:
diff changeset
770 {
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
771 Texture_MM7 *texture; // esi@1
2498
Ritor1
parents:
diff changeset
772 unsigned int slotWidth; // ebx@1
Ritor1
parents:
diff changeset
773 unsigned int slotHeight; // [sp+1Ch] [bp+Ch]@1
Ritor1
parents:
diff changeset
774
Ritor1
parents:
diff changeset
775 texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
776 slotWidth = GetSizeInInventorySlots(texture->uTextureWidth);
Ritor1
parents:
diff changeset
777 slotHeight = GetSizeInInventorySlots(texture->uTextureHeight);
Ritor1
parents:
diff changeset
778 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
779 {
Ritor1
parents:
diff changeset
780 texture->Release();
Ritor1
parents:
diff changeset
781 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
782 }
Ritor1
parents:
diff changeset
783 Assert(slotHeight > 0 && slotWidth > 0, "Items should have nonzero dimensions");
Ritor1
parents:
diff changeset
784 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT )
Ritor1
parents:
diff changeset
785 {
Ritor1
parents:
diff changeset
786 for (unsigned int x = 0; x < slotWidth; x++)
Ritor1
parents:
diff changeset
787 {
Ritor1
parents:
diff changeset
788 for (unsigned int y = 0; y < slotHeight; y++)
Ritor1
parents:
diff changeset
789 {
Ritor1
parents:
diff changeset
790 if (pInventoryMatrix[y * INVETORYSLOTSWIDTH + x + uSlot] != 0)
Ritor1
parents:
diff changeset
791 {
Ritor1
parents:
diff changeset
792 return false;
Ritor1
parents:
diff changeset
793 }
Ritor1
parents:
diff changeset
794 }
Ritor1
parents:
diff changeset
795 }
Ritor1
parents:
diff changeset
796 return true;
Ritor1
parents:
diff changeset
797 }
Ritor1
parents:
diff changeset
798 return false;
Ritor1
parents:
diff changeset
799 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
800
2498
Ritor1
parents:
diff changeset
801
Ritor1
parents:
diff changeset
802 //----- (004925E6) --------------------------------------------------------
Ritor1
parents:
diff changeset
803 int Player::FindFreeInventoryListSlot()
Ritor1
parents:
diff changeset
804 {
Ritor1
parents:
diff changeset
805 for (int i = 0; i < 126; i++ )
Ritor1
parents:
diff changeset
806 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
807 if (pInventoryItemList[i].uItemID == ITEM_NULL)
2498
Ritor1
parents:
diff changeset
808 {
Ritor1
parents:
diff changeset
809 return i;
Ritor1
parents:
diff changeset
810 }
Ritor1
parents:
diff changeset
811 }
Ritor1
parents:
diff changeset
812 return -1;
Ritor1
parents:
diff changeset
813 }
Ritor1
parents:
diff changeset
814
Ritor1
parents:
diff changeset
815 //----- (00492600) --------------------------------------------------------
Ritor1
parents:
diff changeset
816 int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID)
Ritor1
parents:
diff changeset
817 {
Ritor1
parents:
diff changeset
818 int result; // eax@8
Ritor1
parents:
diff changeset
819 signed int freeSlot; // [sp+8h] [bp-4h]@4
Ritor1
parents:
diff changeset
820
Ritor1
parents:
diff changeset
821 freeSlot = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
822 if ( freeSlot == -1 )
Ritor1
parents:
diff changeset
823 {
Ritor1
parents:
diff changeset
824 if ( uActiveCharacter )
Ritor1
parents:
diff changeset
825 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
Ritor1
parents:
diff changeset
826 return 0;
Ritor1
parents:
diff changeset
827 }
Ritor1
parents:
diff changeset
828 else
Ritor1
parents:
diff changeset
829 {
Ritor1
parents:
diff changeset
830 PutItemArInventoryIndex(uItemID, freeSlot, uSlot);
Ritor1
parents:
diff changeset
831 result = freeSlot + 1;
Ritor1
parents:
diff changeset
832 this->pInventoryItemList[freeSlot].uItemID = uItemID;
Ritor1
parents:
diff changeset
833 }
Ritor1
parents:
diff changeset
834 return result;
Ritor1
parents:
diff changeset
835 }
Ritor1
parents:
diff changeset
836 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
837
Ritor1
parents:
diff changeset
838 //----- (00492700) --------------------------------------------------------
Ritor1
parents:
diff changeset
839 int Player::HasSkill(unsigned int uSkillType)
Ritor1
parents:
diff changeset
840 {
Ritor1
parents:
diff changeset
841 if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] )
Ritor1
parents:
diff changeset
842 {
Ritor1
parents:
diff changeset
843 return 1;
Ritor1
parents:
diff changeset
844 }
Ritor1
parents:
diff changeset
845 else
Ritor1
parents:
diff changeset
846 {
Ritor1
parents:
diff changeset
847 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName);
Ritor1
parents:
diff changeset
848 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
849 return 0;
Ritor1
parents:
diff changeset
850 }
Ritor1
parents:
diff changeset
851 }
Ritor1
parents:
diff changeset
852
Ritor1
parents:
diff changeset
853 //----- (00492745) --------------------------------------------------------
Ritor1
parents:
diff changeset
854 void Player::WearItem( unsigned int uItemID )
Ritor1
parents:
diff changeset
855 {
Ritor1
parents:
diff changeset
856 int item_body_anch; // edi@6
Ritor1
parents:
diff changeset
857 int item_indx;
Ritor1
parents:
diff changeset
858 item_indx = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
859
Ritor1
parents:
diff changeset
860 if ( item_indx != -1 )
Ritor1
parents:
diff changeset
861 {
Ritor1
parents:
diff changeset
862 pInventoryItemList[item_indx].uItemID = uItemID;
Ritor1
parents:
diff changeset
863 item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType];
Ritor1
parents:
diff changeset
864 pEquipment.pIndices[item_body_anch] = item_indx + 1;
Ritor1
parents:
diff changeset
865 pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1;
Ritor1
parents:
diff changeset
866 }
Ritor1
parents:
diff changeset
867 }
Ritor1
parents:
diff changeset
868
Ritor1
parents:
diff changeset
869 //----- (004927A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
870 int Player::AddItem(int index, unsigned int uItemID)
Ritor1
parents:
diff changeset
871 {
Ritor1
parents:
diff changeset
872 if ( index == -1 )
Ritor1
parents:
diff changeset
873 {
Ritor1
parents:
diff changeset
874 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++)
Ritor1
parents:
diff changeset
875 {
Ritor1
parents:
diff changeset
876 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++)
Ritor1
parents:
diff changeset
877 {
Ritor1
parents:
diff changeset
878 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID) )
Ritor1
parents:
diff changeset
879 {
Ritor1
parents:
diff changeset
880 return CreateItemInInventory(ycoord * INVETORYSLOTSWIDTH + xcoord, uItemID);
Ritor1
parents:
diff changeset
881 }
Ritor1
parents:
diff changeset
882 }
Ritor1
parents:
diff changeset
883 }
Ritor1
parents:
diff changeset
884 return 0;
Ritor1
parents:
diff changeset
885 }
Ritor1
parents:
diff changeset
886 if ( !CanFitItem(index, uItemID) )
Ritor1
parents:
diff changeset
887 {
Ritor1
parents:
diff changeset
888 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
889 return 0;
Ritor1
parents:
diff changeset
890 }
Ritor1
parents:
diff changeset
891 return CreateItemInInventory(index, uItemID);
Ritor1
parents:
diff changeset
892 }
Ritor1
parents:
diff changeset
893
Ritor1
parents:
diff changeset
894 //----- (00492826) --------------------------------------------------------
Ritor1
parents:
diff changeset
895 int Player::AddItem2(int index, ItemGen *Src)
Ritor1
parents:
diff changeset
896 {
Ritor1
parents:
diff changeset
897 pItemsTable->SetSpecialBonus(Src);
Ritor1
parents:
diff changeset
898
Ritor1
parents:
diff changeset
899 if ( index == -1 )
Ritor1
parents:
diff changeset
900 {
Ritor1
parents:
diff changeset
901 for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++)
Ritor1
parents:
diff changeset
902 {
Ritor1
parents:
diff changeset
903 for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array.
Ritor1
parents:
diff changeset
904 {
Ritor1
parents:
diff changeset
905 if ( CanFitItem(ycoord * INVETORYSLOTSWIDTH + xcoord, Src->uItemID) )
Ritor1
parents:
diff changeset
906 {
Ritor1
parents:
diff changeset
907 return CreateItemInInventory2(ycoord * INVETORYSLOTSWIDTH + xcoord, Src);
Ritor1
parents:
diff changeset
908 }
Ritor1
parents:
diff changeset
909 }
Ritor1
parents:
diff changeset
910 }
Ritor1
parents:
diff changeset
911 return 0;
Ritor1
parents:
diff changeset
912 }
Ritor1
parents:
diff changeset
913 if ( !CanFitItem(index, Src->uItemID) )
Ritor1
parents:
diff changeset
914 return 0;
Ritor1
parents:
diff changeset
915 return CreateItemInInventory2(index, Src);
Ritor1
parents:
diff changeset
916 }
Ritor1
parents:
diff changeset
917
Ritor1
parents:
diff changeset
918 //----- (0049289C) --------------------------------------------------------
Ritor1
parents:
diff changeset
919 int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src )
Ritor1
parents:
diff changeset
920 {
Ritor1
parents:
diff changeset
921 signed int freeSlot; // ebx@1
Ritor1
parents:
diff changeset
922 int result; // eax@6
Ritor1
parents:
diff changeset
923
Ritor1
parents:
diff changeset
924 freeSlot = FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
925 if ( freeSlot == -1 )
Ritor1
parents:
diff changeset
926 {
Ritor1
parents:
diff changeset
927 result = 0;
Ritor1
parents:
diff changeset
928 }
Ritor1
parents:
diff changeset
929 else
Ritor1
parents:
diff changeset
930 {
Ritor1
parents:
diff changeset
931 PutItemArInventoryIndex(Src->uItemID, freeSlot, index);
Ritor1
parents:
diff changeset
932 memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen));
Ritor1
parents:
diff changeset
933 result = freeSlot + 1;
Ritor1
parents:
diff changeset
934 }
Ritor1
parents:
diff changeset
935 return result;
Ritor1
parents:
diff changeset
936 }
Ritor1
parents:
diff changeset
937 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
938
Ritor1
parents:
diff changeset
939 //----- (0049298B) --------------------------------------------------------
Ritor1
parents:
diff changeset
940 void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID
Ritor1
parents:
diff changeset
941 {
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
942 Texture_MM7 *item_texture; // esi@1
2498
Ritor1
parents:
diff changeset
943 int *pInvPos; // esi@4
Ritor1
parents:
diff changeset
944 unsigned int slot_width; // [sp+Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
945 unsigned int slot_height; // [sp+18h] [bp+8h]@1
Ritor1
parents:
diff changeset
946
Ritor1
parents:
diff changeset
947 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
948 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
Ritor1
parents:
diff changeset
949 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
Ritor1
parents:
diff changeset
950 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
951 {
Ritor1
parents:
diff changeset
952 item_texture->Release();
Ritor1
parents:
diff changeset
953 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
954 }
Ritor1
parents:
diff changeset
955 if ( slot_width > 0 )
Ritor1
parents:
diff changeset
956 {
Ritor1
parents:
diff changeset
957 pInvPos = &pInventoryMatrix[index];
Ritor1
parents:
diff changeset
958 for (unsigned int i = 0; i < slot_height; i++)
Ritor1
parents:
diff changeset
959 {
Ritor1
parents:
diff changeset
960 memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn
Ritor1
parents:
diff changeset
961 pInvPos += INVETORYSLOTSWIDTH;
Ritor1
parents:
diff changeset
962 }
Ritor1
parents:
diff changeset
963 }
Ritor1
parents:
diff changeset
964 pInventoryMatrix[index] = itemListPos + 1;
Ritor1
parents:
diff changeset
965 }
Ritor1
parents:
diff changeset
966
Ritor1
parents:
diff changeset
967 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
968
Ritor1
parents:
diff changeset
969 //----- (00492A36) --------------------------------------------------------
Ritor1
parents:
diff changeset
970 void Player::RemoveItemAtInventoryIndex( unsigned int index )
Ritor1
parents:
diff changeset
971 {
Ritor1
parents:
diff changeset
972 ItemGen *item_in_slot; // ecx@1
2574
dd36326a9994 More texture refactoring
a.parshin
parents: 2567
diff changeset
973 Texture_MM7 *item_texture; // esi@1
2498
Ritor1
parents:
diff changeset
974 unsigned int slot_height; // ebp@1
Ritor1
parents:
diff changeset
975 int *pInvPos; // edx@4
Ritor1
parents:
diff changeset
976 unsigned int slot_width; // [sp+14h] [bp+4h]@1
Ritor1
parents:
diff changeset
977
Ritor1
parents:
diff changeset
978 item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1];
Ritor1
parents:
diff changeset
979 item_texture = pIcons_LOD->LoadTexturePtr(item_in_slot->GetIconName(), TEXTURE_16BIT_PALETTE);
Ritor1
parents:
diff changeset
980 item_in_slot->Reset();
Ritor1
parents:
diff changeset
981 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
Ritor1
parents:
diff changeset
982 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
Ritor1
parents:
diff changeset
983 if ( !areWeLoadingTexture )
Ritor1
parents:
diff changeset
984 {
Ritor1
parents:
diff changeset
985 item_texture->Release();
Ritor1
parents:
diff changeset
986 pIcons_LOD->SyncLoadedFilesCount();
Ritor1
parents:
diff changeset
987 }
Ritor1
parents:
diff changeset
988 if ( slot_width > 0 )
Ritor1
parents:
diff changeset
989 {
Ritor1
parents:
diff changeset
990 pInvPos = &pInventoryMatrix[index];
Ritor1
parents:
diff changeset
991 for (unsigned int i = 0; i < slot_height; i++)
Ritor1
parents:
diff changeset
992 {
Ritor1
parents:
diff changeset
993 memset32(pInvPos, 0, slot_width);
Ritor1
parents:
diff changeset
994 pInvPos += INVETORYSLOTSWIDTH;
Ritor1
parents:
diff changeset
995 }
Ritor1
parents:
diff changeset
996 }
Ritor1
parents:
diff changeset
997 }
Ritor1
parents:
diff changeset
998 // 506128: using guessed type int areWeLoadingTexture;
Ritor1
parents:
diff changeset
999
Ritor1
parents:
diff changeset
1000 //----- (00490EEE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1001 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff
Ritor1
parents:
diff changeset
1002 {
Ritor1
parents:
diff changeset
1003 unsigned int idemId; // edx@1
Ritor1
parents:
diff changeset
1004 signed int equipType; // esi@1
Ritor1
parents:
diff changeset
1005 float multiplier; // ST04_4@26
Ritor1
parents:
diff changeset
1006 int price; // edi@26
Ritor1
parents:
diff changeset
1007 int merchantLevel; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
1008 int itemValue;
Ritor1
parents:
diff changeset
1009
Ritor1
parents:
diff changeset
1010 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
Ritor1
parents:
diff changeset
1011 idemId = pItem->uItemID;
Ritor1
parents:
diff changeset
1012 equipType = pItem->GetItemEquipType();
Ritor1
parents:
diff changeset
1013 itemValue = pItem->GetValue();
Ritor1
parents:
diff changeset
1014
Ritor1
parents:
diff changeset
1015 switch (building_type)
Ritor1
parents:
diff changeset
1016 {
Ritor1
parents:
diff changeset
1017 case BuildingType_WeaponShop:
Ritor1
parents:
diff changeset
1018 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1019 return 5;
Ritor1
parents:
diff changeset
1020 if (equipType > EQUIP_BOW)
Ritor1
parents:
diff changeset
1021 return 4;
Ritor1
parents:
diff changeset
1022 break;
Ritor1
parents:
diff changeset
1023 case BuildingType_ArmorShop:
Ritor1
parents:
diff changeset
1024 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1025 return 5;
Ritor1
parents:
diff changeset
1026 if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS)
Ritor1
parents:
diff changeset
1027 return 4;
Ritor1
parents:
diff changeset
1028 break;
Ritor1
parents:
diff changeset
1029 case BuildingType_MagicShop:
Ritor1
parents:
diff changeset
1030 if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS)
Ritor1
parents:
diff changeset
1031 return 5;
Ritor1
parents:
diff changeset
1032 if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC )
Ritor1
parents:
diff changeset
1033 return 4;
Ritor1
parents:
diff changeset
1034 break;
Ritor1
parents:
diff changeset
1035 case BuildingType_AlchemistShop:
Ritor1
parents:
diff changeset
1036 if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE)
Ritor1
parents:
diff changeset
1037 return 5;
Ritor1
parents:
diff changeset
1038 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL))
Ritor1
parents:
diff changeset
1039 return 4;
Ritor1
parents:
diff changeset
1040 break;
Ritor1
parents:
diff changeset
1041 default:
Ritor1
parents:
diff changeset
1042 Error("(%u)", building_type);
Ritor1
parents:
diff changeset
1043 break;
Ritor1
parents:
diff changeset
1044 }
Ritor1
parents:
diff changeset
1045 if (pItem->IsStolen())
Ritor1
parents:
diff changeset
1046 return 6;
Ritor1
parents:
diff changeset
1047
Ritor1
parents:
diff changeset
1048 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier;
Ritor1
parents:
diff changeset
1049 switch (ShopMenuType)
Ritor1
parents:
diff changeset
1050 {
Ritor1
parents:
diff changeset
1051 case 2:
Ritor1
parents:
diff changeset
1052 price = GetBuyingPrice(itemValue, multiplier);
Ritor1
parents:
diff changeset
1053 break;
Ritor1
parents:
diff changeset
1054 case 3:
Ritor1
parents:
diff changeset
1055 if (pItem->IsBroken())
Ritor1
parents:
diff changeset
1056 price = 1;
Ritor1
parents:
diff changeset
1057 else
Ritor1
parents:
diff changeset
1058 price = this->GetPriceSell(itemValue, multiplier);
Ritor1
parents:
diff changeset
1059 break;
Ritor1
parents:
diff changeset
1060 case 4:
Ritor1
parents:
diff changeset
1061 price = this->GetPriceIdentification(multiplier);
Ritor1
parents:
diff changeset
1062 break;
Ritor1
parents:
diff changeset
1063 case 5:
Ritor1
parents:
diff changeset
1064 price = this->GetPriceRepair(itemValue, multiplier);
Ritor1
parents:
diff changeset
1065 break;
Ritor1
parents:
diff changeset
1066 default:
Ritor1
parents:
diff changeset
1067 Error("(%u)", ShopMenuType);
Ritor1
parents:
diff changeset
1068 break;
Ritor1
parents:
diff changeset
1069 }
Ritor1
parents:
diff changeset
1070 if ( merchantLevel )
Ritor1
parents:
diff changeset
1071 {
Ritor1
parents:
diff changeset
1072 if (price == itemValue)
Ritor1
parents:
diff changeset
1073 {
Ritor1
parents:
diff changeset
1074 return 3;
Ritor1
parents:
diff changeset
1075 }
Ritor1
parents:
diff changeset
1076 else
Ritor1
parents:
diff changeset
1077 {
Ritor1
parents:
diff changeset
1078 return 2;
Ritor1
parents:
diff changeset
1079 }
Ritor1
parents:
diff changeset
1080 }
Ritor1
parents:
diff changeset
1081 else
Ritor1
parents:
diff changeset
1082 {
Ritor1
parents:
diff changeset
1083 return 1;
Ritor1
parents:
diff changeset
1084 }
Ritor1
parents:
diff changeset
1085 }
Ritor1
parents:
diff changeset
1086
Ritor1
parents:
diff changeset
1087 //----- (0049107D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1088 int Player::GetBodybuilding()
Ritor1
parents:
diff changeset
1089 {
Ritor1
parents:
diff changeset
1090 int v1; // al@1
Ritor1
parents:
diff changeset
1091
Ritor1
parents:
diff changeset
1092 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING);
Ritor1
parents:
diff changeset
1093 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1094 return multiplier * (v1 & 0x3F);
Ritor1
parents:
diff changeset
1095 }
Ritor1
parents:
diff changeset
1096
Ritor1
parents:
diff changeset
1097 //----- (004910A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
1098 int Player::GetMeditation()
Ritor1
parents:
diff changeset
1099 {
Ritor1
parents:
diff changeset
1100 int v1; // al@1
Ritor1
parents:
diff changeset
1101
Ritor1
parents:
diff changeset
1102 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION);
Ritor1
parents:
diff changeset
1103 int multiplier = GetMultiplierForSkillLevel(v1, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1104 return multiplier * (v1 & 0x3F);
Ritor1
parents:
diff changeset
1105 }
Ritor1
parents:
diff changeset
1106
Ritor1
parents:
diff changeset
1107 //----- (004910D3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1108 bool Player::CanIdentify( ItemGen *pItem )
Ritor1
parents:
diff changeset
1109 {
Ritor1
parents:
diff changeset
1110 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1111 int v5; // edi@7
Ritor1
parents:
diff changeset
1112 if (CheckHiredNPCSpeciality(Scholar))
Ritor1
parents:
diff changeset
1113 return true;
Ritor1
parents:
diff changeset
1114
Ritor1
parents:
diff changeset
1115 v2 = GetActualSkillLevel(PLAYER_SKILL_ITEM_ID);
Ritor1
parents:
diff changeset
1116 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1117 return true;
Ritor1
parents:
diff changeset
1118
Ritor1
parents:
diff changeset
1119 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1120 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1121 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
Ritor1
parents:
diff changeset
1122 }
Ritor1
parents:
diff changeset
1123
Ritor1
parents:
diff changeset
1124 //----- (00491151) --------------------------------------------------------
Ritor1
parents:
diff changeset
1125 bool Player::CanRepair( ItemGen *pItem )
Ritor1
parents:
diff changeset
1126 {
Ritor1
parents:
diff changeset
1127 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1128 int v5; // edi@7
Ritor1
parents:
diff changeset
1129
Ritor1
parents:
diff changeset
1130 ITEM_EQUIP_TYPE equipType = pItem->GetItemEquipType();
Ritor1
parents:
diff changeset
1131 if (CheckHiredNPCSpeciality(Smith) && equipType <= 2 ||
Ritor1
parents:
diff changeset
1132 CheckHiredNPCSpeciality(Armorer) && equipType >= 3 && equipType <= 9 ||
Ritor1
parents:
diff changeset
1133 CheckHiredNPCSpeciality(Alchemist) && equipType >= 9 )
Ritor1
parents:
diff changeset
1134 return true;
Ritor1
parents:
diff changeset
1135
Ritor1
parents:
diff changeset
1136 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR);
Ritor1
parents:
diff changeset
1137 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1138 return true;
Ritor1
parents:
diff changeset
1139
Ritor1
parents:
diff changeset
1140 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1141 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1142 return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St;
Ritor1
parents:
diff changeset
1143 }
Ritor1
parents:
diff changeset
1144
Ritor1
parents:
diff changeset
1145 //----- (004911F3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1146 int Player::GetMerchant()
Ritor1
parents:
diff changeset
1147 {
Ritor1
parents:
diff changeset
1148 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1149 int v5; // edi@1
Ritor1
parents:
diff changeset
1150 int v7; // eax@3
Ritor1
parents:
diff changeset
1151
Ritor1
parents:
diff changeset
1152 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
Ritor1
parents:
diff changeset
1153 if ( SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1154 return 10000;
Ritor1
parents:
diff changeset
1155
Ritor1
parents:
diff changeset
1156 v7 = pParty->GetPartyReputation();
Ritor1
parents:
diff changeset
1157 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1158 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1159 if (v5 == 0)
Ritor1
parents:
diff changeset
1160 {
Ritor1
parents:
diff changeset
1161 return -v7;
Ritor1
parents:
diff changeset
1162 }
Ritor1
parents:
diff changeset
1163 return v5 - v7 + 7;
Ritor1
parents:
diff changeset
1164 }
Ritor1
parents:
diff changeset
1165
Ritor1
parents:
diff changeset
1166 //----- (0049125A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1167 int Player::GetPerception()
Ritor1
parents:
diff changeset
1168 {
Ritor1
parents:
diff changeset
1169 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1170 int v5; // edi@1
Ritor1
parents:
diff changeset
1171
Ritor1
parents:
diff changeset
1172 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION);
Ritor1
parents:
diff changeset
1173 if ( SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1174 return 10000;
Ritor1
parents:
diff changeset
1175
Ritor1
parents:
diff changeset
1176 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1177 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1178 return v5;
Ritor1
parents:
diff changeset
1179 }
Ritor1
parents:
diff changeset
1180
Ritor1
parents:
diff changeset
1181 //----- (004912B0) --------------------------------------------------------
Ritor1
parents:
diff changeset
1182 int Player::GetDisarmTrap()
Ritor1
parents:
diff changeset
1183 {
Ritor1
parents:
diff changeset
1184 unsigned __int16 v2; // ax@1
Ritor1
parents:
diff changeset
1185 int v5; // edi@1
Ritor1
parents:
diff changeset
1186
Ritor1
parents:
diff changeset
1187 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM);
Ritor1
parents:
diff changeset
1188 if ( (signed int)SkillToMastery(v2) >= 4 )
Ritor1
parents:
diff changeset
1189 return 10000;
Ritor1
parents:
diff changeset
1190
Ritor1
parents:
diff changeset
1191 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1192 if ( HasEnchantedItemEquipped(35) ) //only the real skill level is supposed to be added again, not the multiplied value
Ritor1
parents:
diff changeset
1193 multiplier++;
Ritor1
parents:
diff changeset
1194 v5 = multiplier * (v2 & 0x3F);
Ritor1
parents:
diff changeset
1195 return v5;
Ritor1
parents:
diff changeset
1196 }
Ritor1
parents:
diff changeset
1197
Ritor1
parents:
diff changeset
1198 //----- (00491317) --------------------------------------------------------
Ritor1
parents:
diff changeset
1199 char Player::GetLearningPercent()
Ritor1
parents:
diff changeset
1200 {
Ritor1
parents:
diff changeset
1201 int v2; // eax@1
Ritor1
parents:
diff changeset
1202
Ritor1
parents:
diff changeset
1203 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING);
Ritor1
parents:
diff changeset
1204 int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
1205 return multiplier * v2 + 9;
Ritor1
parents:
diff changeset
1206 }
Ritor1
parents:
diff changeset
1207
Ritor1
parents:
diff changeset
1208 //----- (0048C6AF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1209 Player::Player()
Ritor1
parents:
diff changeset
1210 {
Ritor1
parents:
diff changeset
1211 memset(&pEquipment, 0, sizeof(PlayerEquipment));
Ritor1
parents:
diff changeset
1212 pInventoryMatrix.fill(0);
Ritor1
parents:
diff changeset
1213 for (uint i = 0; i < 126; ++i)
Ritor1
parents:
diff changeset
1214 pInventoryItemList[i].Reset();
Ritor1
parents:
diff changeset
1215 for (uint i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
1216 pEquippedItems[i].Reset();
Ritor1
parents:
diff changeset
1217
Ritor1
parents:
diff changeset
1218
Ritor1
parents:
diff changeset
1219 for (uint i = 0; i < 24; ++i)
Ritor1
parents:
diff changeset
1220 {
Ritor1
parents:
diff changeset
1221 pPlayerBuffs[i].uSkill = 0;
Ritor1
parents:
diff changeset
1222 pPlayerBuffs[i].uSkill = 0;
Ritor1
parents:
diff changeset
1223 pPlayerBuffs[i].uPower = 0;
Ritor1
parents:
diff changeset
1224 pPlayerBuffs[i].uExpireTime = 0;
Ritor1
parents:
diff changeset
1225 pPlayerBuffs[i].uCaster = 0;
Ritor1
parents:
diff changeset
1226 pPlayerBuffs[i].uFlags = 0;
Ritor1
parents:
diff changeset
1227 }
Ritor1
parents:
diff changeset
1228
Ritor1
parents:
diff changeset
1229 pName[0] = 0;
Ritor1
parents:
diff changeset
1230 uCurrentFace = 0;
Ritor1
parents:
diff changeset
1231 uVoiceID = 0;
Ritor1
parents:
diff changeset
1232 pConditions.fill(0);
Ritor1
parents:
diff changeset
1233
Ritor1
parents:
diff changeset
1234 field_BB = 0;
Ritor1
parents:
diff changeset
1235
Ritor1
parents:
diff changeset
1236 uMight = uMightBonus = 0;
Ritor1
parents:
diff changeset
1237 uIntelligence = uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
1238 uWillpower = uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
1239 uEndurance = uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
1240 uSpeed = uSpeedBonus = 0;
Ritor1
parents:
diff changeset
1241 uAccuracy = uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
1242 uLuck = uLuckBonus = 0;
Ritor1
parents:
diff changeset
1243 uLevel = sLevelModifier = 0;
Ritor1
parents:
diff changeset
1244 sAgeModifier = 0;
Ritor1
parents:
diff changeset
1245 sACModifier = 0;
Ritor1
parents:
diff changeset
1246
Ritor1
parents:
diff changeset
1247 // memset(field_1F5, 0, 30);
Ritor1
parents:
diff changeset
1248 pure_luck_used=0;
Ritor1
parents:
diff changeset
1249 pure_speed_used=0;
Ritor1
parents:
diff changeset
1250 pure_intellect_used=0;
Ritor1
parents:
diff changeset
1251 pure_endurance_used=0;
Ritor1
parents:
diff changeset
1252 pure_willpower_used=0;
Ritor1
parents:
diff changeset
1253 pure_accuracy_used=0;
Ritor1
parents:
diff changeset
1254 pure_might_used=0;
Ritor1
parents:
diff changeset
1255
Ritor1
parents:
diff changeset
1256 sResFireBase = sResFireBonus = 0;
Ritor1
parents:
diff changeset
1257 sResAirBase = sResAirBonus = 0;
Ritor1
parents:
diff changeset
1258 sResWaterBase = sResWaterBonus = 0;
Ritor1
parents:
diff changeset
1259 sResEarthBase = sResEarthBonus = 0;
Ritor1
parents:
diff changeset
1260 sResMagicBase = sResMagicBonus = 0;
Ritor1
parents:
diff changeset
1261 sResSpiritBase = sResSpiritBonus = 0;
Ritor1
parents:
diff changeset
1262 sResMindBase = sResMindBonus = 0;
Ritor1
parents:
diff changeset
1263 sResBodyBase = sResBodyBonus = 0;
Ritor1
parents:
diff changeset
1264 sResLightBase = sResLightBonus = 0;
Ritor1
parents:
diff changeset
1265 sResDarkBase = sResDarkBonus = 0;
Ritor1
parents:
diff changeset
1266
Ritor1
parents:
diff changeset
1267 uTimeToRecovery = 0;
Ritor1
parents:
diff changeset
1268
Ritor1
parents:
diff changeset
1269 uSkillPoints = 0;
Ritor1
parents:
diff changeset
1270
Ritor1
parents:
diff changeset
1271 sHealth = 0;
Ritor1
parents:
diff changeset
1272 uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
1273 _health_related = 0;
Ritor1
parents:
diff changeset
1274
Ritor1
parents:
diff changeset
1275 sMana = 0;
Ritor1
parents:
diff changeset
1276 uFullManaBonus = 0;
Ritor1
parents:
diff changeset
1277 _mana_related = 0;
Ritor1
parents:
diff changeset
1278
Ritor1
parents:
diff changeset
1279 uQuickSpell = 0;
Ritor1
parents:
diff changeset
1280 memset(pInstalledBeacons.data(), 0, 5 * sizeof(LloydBeacon));
Ritor1
parents:
diff changeset
1281
Ritor1
parents:
diff changeset
1282 _some_attack_bonus = 0;
Ritor1
parents:
diff changeset
1283 field_1A91 = 0;
Ritor1
parents:
diff changeset
1284 _melee_dmg_bonus = 0;
Ritor1
parents:
diff changeset
1285 field_1A93 = 0;
Ritor1
parents:
diff changeset
1286 _ranged_atk_bonus = 0;
Ritor1
parents:
diff changeset
1287 field_1A95 = 0;
Ritor1
parents:
diff changeset
1288 _ranged_dmg_bonus = 0;
Ritor1
parents:
diff changeset
1289 field_1A97 = 0;
Ritor1
parents:
diff changeset
1290
Ritor1
parents:
diff changeset
1291 expression = CHARACTER_EXPRESSION_INVALID;
Ritor1
parents:
diff changeset
1292 uExpressionTimePassed = 0;
Ritor1
parents:
diff changeset
1293 uExpressionTimeLength = 0;
Ritor1
parents:
diff changeset
1294
Ritor1
parents:
diff changeset
1295 uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
1296 uNumArmageddonCasts = 0;
Ritor1
parents:
diff changeset
1297 uNumFireSpikeCasts = 0;
Ritor1
parents:
diff changeset
1298
Ritor1
parents:
diff changeset
1299 memset(field_1988, 0, sizeof(field_1988));
Ritor1
parents:
diff changeset
1300 memset(playerEventBits, 0, sizeof(playerEventBits));
Ritor1
parents:
diff changeset
1301
Ritor1
parents:
diff changeset
1302 field_E0 = 0;
Ritor1
parents:
diff changeset
1303 field_E4 = 0;
Ritor1
parents:
diff changeset
1304 field_E8 = 0;
Ritor1
parents:
diff changeset
1305 field_EC = 0;
Ritor1
parents:
diff changeset
1306 field_F0 = 0;
Ritor1
parents:
diff changeset
1307 field_F4 = 0;
Ritor1
parents:
diff changeset
1308 field_F8 = 0;
Ritor1
parents:
diff changeset
1309 field_FC = 0;
Ritor1
parents:
diff changeset
1310 field_100 = 0;
Ritor1
parents:
diff changeset
1311 field_104 = 0;
Ritor1
parents:
diff changeset
1312
Ritor1
parents:
diff changeset
1313 _expression21_animtime = 0;
Ritor1
parents:
diff changeset
1314 _expression21_frameset = 0;
Ritor1
parents:
diff changeset
1315
Ritor1
parents:
diff changeset
1316 lastOpenedSpellbookPage = 0;
Ritor1
parents:
diff changeset
1317 }
Ritor1
parents:
diff changeset
1318
Ritor1
parents:
diff changeset
1319
Ritor1
parents:
diff changeset
1320 //----- (0048C855) --------------------------------------------------------
Ritor1
parents:
diff changeset
1321 int Player::GetBaseStrength()
Ritor1
parents:
diff changeset
1322 {
Ritor1
parents:
diff changeset
1323 return this->uMight + GetItemsBonus(CHARACTER_ATTRIBUTE_STRENGTH);
Ritor1
parents:
diff changeset
1324 }
Ritor1
parents:
diff changeset
1325
Ritor1
parents:
diff changeset
1326 //----- (0048C86C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1327 int Player::GetBaseIntelligence()
Ritor1
parents:
diff changeset
1328 {
Ritor1
parents:
diff changeset
1329 return this->uIntelligence + GetItemsBonus(CHARACTER_ATTRIBUTE_INTELLIGENCE);
Ritor1
parents:
diff changeset
1330 }
Ritor1
parents:
diff changeset
1331
Ritor1
parents:
diff changeset
1332 //----- (0048C883) --------------------------------------------------------
Ritor1
parents:
diff changeset
1333 int Player::GetBaseWillpower()
Ritor1
parents:
diff changeset
1334 {
Ritor1
parents:
diff changeset
1335 return this->uWillpower + GetItemsBonus(CHARACTER_ATTRIBUTE_WILLPOWER);
Ritor1
parents:
diff changeset
1336 }
Ritor1
parents:
diff changeset
1337
Ritor1
parents:
diff changeset
1338 //----- (0048C89A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1339 int Player::GetBaseEndurance()
Ritor1
parents:
diff changeset
1340 {
Ritor1
parents:
diff changeset
1341 return this->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE);
Ritor1
parents:
diff changeset
1342 }
Ritor1
parents:
diff changeset
1343
Ritor1
parents:
diff changeset
1344 //----- (0048C8B1) --------------------------------------------------------
Ritor1
parents:
diff changeset
1345 int Player::GetBaseAccuracy()
Ritor1
parents:
diff changeset
1346 {
Ritor1
parents:
diff changeset
1347 return this->uAccuracy + GetItemsBonus(CHARACTER_ATTRIBUTE_ACCURACY);
Ritor1
parents:
diff changeset
1348 }
Ritor1
parents:
diff changeset
1349
Ritor1
parents:
diff changeset
1350 //----- (0048C8C8) --------------------------------------------------------
Ritor1
parents:
diff changeset
1351 int Player::GetBaseSpeed()
Ritor1
parents:
diff changeset
1352 {
Ritor1
parents:
diff changeset
1353 return this->uSpeed + GetItemsBonus(CHARACTER_ATTRIBUTE_SPEED);
Ritor1
parents:
diff changeset
1354 }
Ritor1
parents:
diff changeset
1355
Ritor1
parents:
diff changeset
1356 //----- (0048C8DF) --------------------------------------------------------
Ritor1
parents:
diff changeset
1357 int Player::GetBaseLuck()
Ritor1
parents:
diff changeset
1358 {
Ritor1
parents:
diff changeset
1359 return this->uLuck + GetItemsBonus(CHARACTER_ATTRIBUTE_LUCK);
Ritor1
parents:
diff changeset
1360 }
Ritor1
parents:
diff changeset
1361
Ritor1
parents:
diff changeset
1362 //----- (0048C8F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1363 int Player::GetBaseLevel()
Ritor1
parents:
diff changeset
1364 {
Ritor1
parents:
diff changeset
1365 return this->uLevel + GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
Ritor1
parents:
diff changeset
1366 }
Ritor1
parents:
diff changeset
1367
Ritor1
parents:
diff changeset
1368 //----- (0048C90D) --------------------------------------------------------
Ritor1
parents:
diff changeset
1369 int Player::GetActualLevel()
Ritor1
parents:
diff changeset
1370 {
Ritor1
parents:
diff changeset
1371 return uLevel + sLevelModifier +
Ritor1
parents:
diff changeset
1372 GetMagicalBonus(CHARACTER_ATTRIBUTE_LEVEL) +
Ritor1
parents:
diff changeset
1373 GetItemsBonus(CHARACTER_ATTRIBUTE_LEVEL);
Ritor1
parents:
diff changeset
1374 }
Ritor1
parents:
diff changeset
1375
Ritor1
parents:
diff changeset
1376 //----- (0048C93C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1377 int Player::GetActualMight()
Ritor1
parents:
diff changeset
1378 {
Ritor1
parents:
diff changeset
1379 return GetActualAttribute(CHARACTER_ATTRIBUTE_STRENGTH, &Player::uMight, &Player::uMightBonus);
Ritor1
parents:
diff changeset
1380 }
Ritor1
parents:
diff changeset
1381
Ritor1
parents:
diff changeset
1382 //----- (0048C9C2) --------------------------------------------------------
Ritor1
parents:
diff changeset
1383 int Player::GetActualIntelligence()
Ritor1
parents:
diff changeset
1384 {
Ritor1
parents:
diff changeset
1385 return GetActualAttribute(CHARACTER_ATTRIBUTE_INTELLIGENCE, &Player::uIntelligence, &Player::uIntelligenceBonus);
Ritor1
parents:
diff changeset
1386 }
Ritor1
parents:
diff changeset
1387
Ritor1
parents:
diff changeset
1388 //----- (0048CA3F) --------------------------------------------------------
Ritor1
parents:
diff changeset
1389 int Player::GetActualWillpower()
Ritor1
parents:
diff changeset
1390 {
Ritor1
parents:
diff changeset
1391 return GetActualAttribute(CHARACTER_ATTRIBUTE_WILLPOWER, &Player::uWillpower, &Player::uWillpowerBonus);
Ritor1
parents:
diff changeset
1392 }
Ritor1
parents:
diff changeset
1393
Ritor1
parents:
diff changeset
1394 //----- (0048CABC) --------------------------------------------------------
Ritor1
parents:
diff changeset
1395 int Player::GetActualEndurance()
Ritor1
parents:
diff changeset
1396 {
Ritor1
parents:
diff changeset
1397 return GetActualAttribute(CHARACTER_ATTRIBUTE_ENDURANCE, &Player::uEndurance, &Player::uEnduranceBonus);
Ritor1
parents:
diff changeset
1398 }
Ritor1
parents:
diff changeset
1399
Ritor1
parents:
diff changeset
1400 //----- (0048CB39) --------------------------------------------------------
Ritor1
parents:
diff changeset
1401 int Player::GetActualAccuracy()
Ritor1
parents:
diff changeset
1402 {
Ritor1
parents:
diff changeset
1403 return GetActualAttribute(CHARACTER_ATTRIBUTE_ACCURACY, &Player::uAccuracy, &Player::uAccuracyBonus);
Ritor1
parents:
diff changeset
1404 }
Ritor1
parents:
diff changeset
1405
Ritor1
parents:
diff changeset
1406 //----- (0048CBB6) --------------------------------------------------------
Ritor1
parents:
diff changeset
1407 int Player::GetActualSpeed()
Ritor1
parents:
diff changeset
1408 {
Ritor1
parents:
diff changeset
1409 return GetActualAttribute(CHARACTER_ATTRIBUTE_SPEED, &Player::uSpeed, &Player::uSpeedBonus);
Ritor1
parents:
diff changeset
1410 }
Ritor1
parents:
diff changeset
1411
Ritor1
parents:
diff changeset
1412 //----- (0048CC33) --------------------------------------------------------
Ritor1
parents:
diff changeset
1413 int Player::GetActualLuck()
Ritor1
parents:
diff changeset
1414 {
Ritor1
parents:
diff changeset
1415 signed int npc_luck_bonus; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1416
Ritor1
parents:
diff changeset
1417 npc_luck_bonus = 0;
Ritor1
parents:
diff changeset
1418 if ( CheckHiredNPCSpeciality(Fool) )
Ritor1
parents:
diff changeset
1419 npc_luck_bonus = 5;
Ritor1
parents:
diff changeset
1420 if ( CheckHiredNPCSpeciality(ChimneySweep) )
Ritor1
parents:
diff changeset
1421 npc_luck_bonus += 20;
Ritor1
parents:
diff changeset
1422 if ( CheckHiredNPCSpeciality(Psychic) )
Ritor1
parents:
diff changeset
1423 npc_luck_bonus += 10;
Ritor1
parents:
diff changeset
1424
Ritor1
parents:
diff changeset
1425 return GetActualAttribute(CHARACTER_ATTRIBUTE_LUCK, &Player::uLuck, &Player::uLuckBonus)
Ritor1
parents:
diff changeset
1426 + npc_luck_bonus;
Ritor1
parents:
diff changeset
1427 }
Ritor1
parents:
diff changeset
1428
Ritor1
parents:
diff changeset
1429 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
1430 int Player::GetActualAttribute( CHARACTER_ATTRIBUTE_TYPE attrId, unsigned short Player::* attrValue, unsigned short Player::* attrBonus )
Ritor1
parents:
diff changeset
1431 {
Ritor1
parents:
diff changeset
1432 uint uActualAge = this->sAgeModifier + GetBaseAge();
Ritor1
parents:
diff changeset
1433 uint uAgeingMultiplier = 100;
Ritor1
parents:
diff changeset
1434 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
1435 {
Ritor1
parents:
diff changeset
1436 if (uActualAge >= pAgeingTable[i])
Ritor1
parents:
diff changeset
1437 uAgeingMultiplier = pAgingAttributeModifier[attrId][i];
Ritor1
parents:
diff changeset
1438 else
Ritor1
parents:
diff changeset
1439 break;
Ritor1
parents:
diff changeset
1440 }
Ritor1
parents:
diff changeset
1441
Ritor1
parents:
diff changeset
1442 uchar uConditionMult = pConditionAttributeModifier[attrId][GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
1443 int magicBonus = GetMagicalBonus(attrId);
Ritor1
parents:
diff changeset
1444 int itemBonus = GetItemsBonus(attrId);
Ritor1
parents:
diff changeset
1445 return uConditionMult * uAgeingMultiplier * this->*attrValue / 100 / 100
Ritor1
parents:
diff changeset
1446 + magicBonus
Ritor1
parents:
diff changeset
1447 + itemBonus
Ritor1
parents:
diff changeset
1448 + this->*attrBonus;
Ritor1
parents:
diff changeset
1449 }
Ritor1
parents:
diff changeset
1450
Ritor1
parents:
diff changeset
1451 //----- (0048CCF5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1452 int Player::GetActualAttack( bool a2 )
Ritor1
parents:
diff changeset
1453 {
Ritor1
parents:
diff changeset
1454 int v3; // eax@1
Ritor1
parents:
diff changeset
1455 int v4; // edi@1
Ritor1
parents:
diff changeset
1456 int v5; // ebx@1
Ritor1
parents:
diff changeset
1457 int v6; // ebp@1
Ritor1
parents:
diff changeset
1458
Ritor1
parents:
diff changeset
1459 v3 = GetActualAccuracy();
Ritor1
parents:
diff changeset
1460 v4 = GetParameterBonus(v3);
Ritor1
parents:
diff changeset
1461 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_ATTACK);
Ritor1
parents:
diff changeset
1462 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_ATTACK, a2);
Ritor1
parents:
diff changeset
1463 return v4 + v5 + v6 + GetMagicalBonus(CHARACTER_ATTRIBUTE_ATTACK) + this->_some_attack_bonus;
Ritor1
parents:
diff changeset
1464 }
Ritor1
parents:
diff changeset
1465
Ritor1
parents:
diff changeset
1466 //----- (0048CD45) --------------------------------------------------------
Ritor1
parents:
diff changeset
1467 int Player::GetMeleeDamageMinimal()
Ritor1
parents:
diff changeset
1468 {
Ritor1
parents:
diff changeset
1469 int v2; // eax@1
Ritor1
parents:
diff changeset
1470 int v3; // esi@1
Ritor1
parents:
diff changeset
1471 int v4; // esi@1
Ritor1
parents:
diff changeset
1472 int v5; // esi@1
Ritor1
parents:
diff changeset
1473 signed int result; // eax@1
Ritor1
parents:
diff changeset
1474
Ritor1
parents:
diff changeset
1475 v2 = GetActualMight();
Ritor1
parents:
diff changeset
1476 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
1477 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN) + v3;
Ritor1
parents:
diff changeset
1478 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
Ritor1
parents:
diff changeset
1479 result = _melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
Ritor1
parents:
diff changeset
1480 if ( result < 1 )
Ritor1
parents:
diff changeset
1481 result = 1;
Ritor1
parents:
diff changeset
1482 return result;
Ritor1
parents:
diff changeset
1483 }
Ritor1
parents:
diff changeset
1484
Ritor1
parents:
diff changeset
1485 //----- (0048CD90) --------------------------------------------------------
Ritor1
parents:
diff changeset
1486 int Player::GetMeleeDamageMaximal()
Ritor1
parents:
diff changeset
1487 {
Ritor1
parents:
diff changeset
1488 int v2; // eax@1
Ritor1
parents:
diff changeset
1489 int v3; // esi@1
Ritor1
parents:
diff changeset
1490 int v4; // esi@1
Ritor1
parents:
diff changeset
1491 int v5; // esi@1
Ritor1
parents:
diff changeset
1492 int v6; // esi@1
Ritor1
parents:
diff changeset
1493 signed int result; // eax@1
Ritor1
parents:
diff changeset
1494
Ritor1
parents:
diff changeset
1495 v2 = GetActualMight();
Ritor1
parents:
diff changeset
1496 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
1497 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX) + v3;
Ritor1
parents:
diff changeset
1498 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v4;
Ritor1
parents:
diff changeset
1499 v6 = this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + v5;
Ritor1
parents:
diff changeset
1500 result = 1;
Ritor1
parents:
diff changeset
1501 if ( v6 >= 1 )
Ritor1
parents:
diff changeset
1502 result = v6;
Ritor1
parents:
diff changeset
1503 return result;
Ritor1
parents:
diff changeset
1504 }
Ritor1
parents:
diff changeset
1505
Ritor1
parents:
diff changeset
1506 //----- (0048CDDB) --------------------------------------------------------
Ritor1
parents:
diff changeset
1507 int Player::CalculateMeleeDamageTo( bool ignoreSkillBonus, bool ignoreOffhand, unsigned int uTargetActorID )
Ritor1
parents:
diff changeset
1508 {
Ritor1
parents:
diff changeset
1509 int dmgSum; // esi@62
Ritor1
parents:
diff changeset
1510 signed int result; // eax@64
Ritor1
parents:
diff changeset
1511 int mainWpnDmg; // [sp+18h] [bp-8h]@1
Ritor1
parents:
diff changeset
1512 int offHndWpnDmg; // [sp+1Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
1513
Ritor1
parents:
diff changeset
1514 offHndWpnDmg = 0;
Ritor1
parents:
diff changeset
1515 mainWpnDmg = 0;
Ritor1
parents:
diff changeset
1516 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
1517 {
Ritor1
parents:
diff changeset
1518 mainWpnDmg = rand() % 3 + 1;
Ritor1
parents:
diff changeset
1519 }
Ritor1
parents:
diff changeset
1520 else
Ritor1
parents:
diff changeset
1521 {
Ritor1
parents:
diff changeset
1522 if ( HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
1523 {
Ritor1
parents:
diff changeset
1524 ItemGen *mainHandItemGen = this->GetMainHandItem();
Ritor1
parents:
diff changeset
1525 int itemId = mainHandItemGen->uItemID;
Ritor1
parents:
diff changeset
1526 bool addOneDice = false;
Ritor1
parents:
diff changeset
1527 if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield )
Ritor1
parents:
diff changeset
1528 addOneDice = true;
Ritor1
parents:
diff changeset
1529 mainWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(mainHandItemGen, uTargetActorID, addOneDice);
Ritor1
parents:
diff changeset
1530 }
Ritor1
parents:
diff changeset
1531 if ( !ignoreOffhand )
Ritor1
parents:
diff changeset
1532 {
Ritor1
parents:
diff changeset
1533 if ( this->HasItemEquipped(EQUIP_SINGLE_HANDED) )
Ritor1
parents:
diff changeset
1534 {
Ritor1
parents:
diff changeset
1535 ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1];
Ritor1
parents:
diff changeset
1536 if ( offHandItemGen->GetItemEquipType() != EQUIP_SHIELD )
Ritor1
parents:
diff changeset
1537 {
Ritor1
parents:
diff changeset
1538 offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false);
Ritor1
parents:
diff changeset
1539 }
Ritor1
parents:
diff changeset
1540 }
Ritor1
parents:
diff changeset
1541 }
Ritor1
parents:
diff changeset
1542 }
Ritor1
parents:
diff changeset
1543 dmgSum = mainWpnDmg + offHndWpnDmg;
Ritor1
parents:
diff changeset
1544 if ( !ignoreSkillBonus )
Ritor1
parents:
diff changeset
1545 {
Ritor1
parents:
diff changeset
1546 int might = GetActualMight();
Ritor1
parents:
diff changeset
1547 int mightBonus = GetParameterBonus(might);
Ritor1
parents:
diff changeset
1548 int mightAndSkillbonus = GetSkillBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightBonus;
Ritor1
parents:
diff changeset
1549 dmgSum += this->_melee_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS) + mightAndSkillbonus;
Ritor1
parents:
diff changeset
1550 }
Ritor1
parents:
diff changeset
1551 result = 1;
Ritor1
parents:
diff changeset
1552 if ( dmgSum >= 1 )
Ritor1
parents:
diff changeset
1553 result = dmgSum;
Ritor1
parents:
diff changeset
1554 return result;
Ritor1
parents:
diff changeset
1555 }
Ritor1
parents:
diff changeset
1556
Ritor1
parents:
diff changeset
1557
Ritor1
parents:
diff changeset
1558 int Player::CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice )
Ritor1
parents:
diff changeset
1559 {
Ritor1
parents:
diff changeset
1560 int itemId = weapon->uItemID;
Ritor1
parents:
diff changeset
1561 int diceCount = pItemsTable->pItems[itemId].uDamageDice;
Ritor1
parents:
diff changeset
1562 if (addOneDice)
Ritor1
parents:
diff changeset
1563 {
Ritor1
parents:
diff changeset
1564 diceCount++;
Ritor1
parents:
diff changeset
1565 }
Ritor1
parents:
diff changeset
1566 int diceSides = pItemsTable->pItems[itemId].uDamageRoll;
Ritor1
parents:
diff changeset
1567 int diceResult = 0;
Ritor1
parents:
diff changeset
1568 for (int i = 0; i < diceCount; i++)
Ritor1
parents:
diff changeset
1569 {
Ritor1
parents:
diff changeset
1570 diceResult += rand() % diceSides + 1;
Ritor1
parents:
diff changeset
1571 }
Ritor1
parents:
diff changeset
1572 int totalDmg = pItemsTable->pItems[itemId].uDamageMod + diceResult;
Ritor1
parents:
diff changeset
1573 if ( uTargetActorID > 0)
Ritor1
parents:
diff changeset
1574 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
1575 int enchType = weapon->special_enchantment;
2498
Ritor1
parents:
diff changeset
1576 if ( MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_UNDEAD) && (enchType == 64 || itemId == ITEM_ARTIFACT_GHOULSBANE || itemId == ITEM_ARTIFACT_GIBBET || itemId == ITEM_RELIC_JUSTICE) )
Ritor1
parents:
diff changeset
1577 {
Ritor1
parents:
diff changeset
1578 totalDmg *= 2;
Ritor1
parents:
diff changeset
1579 }
Ritor1
parents:
diff changeset
1580 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_KREEGAN) && ( enchType == 39 || itemId == ITEM_ARTIFACT_GIBBET))
Ritor1
parents:
diff changeset
1581 {
Ritor1
parents:
diff changeset
1582 totalDmg *= 2;
Ritor1
parents:
diff changeset
1583 }
Ritor1
parents:
diff changeset
1584 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_DRAGON) && ( enchType == 40 || itemId == ITEM_ARTIFACT_GIBBET))
Ritor1
parents:
diff changeset
1585 {
Ritor1
parents:
diff changeset
1586 totalDmg *= 2;
Ritor1
parents:
diff changeset
1587 }
Ritor1
parents:
diff changeset
1588 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_ELF) && ( enchType == 63 || itemId == ITEM_RELIC_OLD_NICK))
Ritor1
parents:
diff changeset
1589 {
Ritor1
parents:
diff changeset
1590 totalDmg *= 2;
Ritor1
parents:
diff changeset
1591 }
Ritor1
parents:
diff changeset
1592 else if (MonsterStats::BelongsToSupertype(uTargetActorID, MONSTER_SUPERTYPE_TITAN) && ( enchType == 65 ))
Ritor1
parents:
diff changeset
1593 {
Ritor1
parents:
diff changeset
1594 totalDmg *= 2;
Ritor1
parents:
diff changeset
1595 }
Ritor1
parents:
diff changeset
1596 }
Ritor1
parents:
diff changeset
1597 if ( (signed int)SkillToMastery(this->pActiveSkills[PLAYER_SKILL_DAGGER]) >= 3
Ritor1
parents:
diff changeset
1598 && pItemsTable->pItems[itemId].uSkillType == 2
Ritor1
parents:
diff changeset
1599 && rand() % 100 < 10 )
Ritor1
parents:
diff changeset
1600 totalDmg *= 3;
Ritor1
parents:
diff changeset
1601 return totalDmg;
Ritor1
parents:
diff changeset
1602 }
Ritor1
parents:
diff changeset
1603
Ritor1
parents:
diff changeset
1604
Ritor1
parents:
diff changeset
1605 //----- (0048D0B9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1606 int Player::GetRangedAttack()
Ritor1
parents:
diff changeset
1607 {
Ritor1
parents:
diff changeset
1608 int v3; // edi@3
Ritor1
parents:
diff changeset
1609 //int v4; // eax@4
Ritor1
parents:
diff changeset
1610 //int v5; // edi@4
Ritor1
parents:
diff changeset
1611 int v6; // edi@4
Ritor1
parents:
diff changeset
1612 int v7; // edi@4
Ritor1
parents:
diff changeset
1613
Ritor1
parents:
diff changeset
1614 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1615 if ( mainHandItem != nullptr && ( mainHandItem->uItemID < ITEM_BLASTER || mainHandItem->uItemID > ITEM_LASER_RIFLE ))
Ritor1
parents:
diff changeset
1616 {
Ritor1
parents:
diff changeset
1617 //v4 = GetActualAccuracy();
Ritor1
parents:
diff changeset
1618 //v5 = GetParameterBonus(GetActualAccuracy());
Ritor1
parents:
diff changeset
1619 v6 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + GetParameterBonus(GetActualAccuracy());
Ritor1
parents:
diff changeset
1620 v7 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v6;
Ritor1
parents:
diff changeset
1621 v3 = this->_ranged_atk_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_ATTACK) + v7;
Ritor1
parents:
diff changeset
1622 }
Ritor1
parents:
diff changeset
1623 else
Ritor1
parents:
diff changeset
1624 {
Ritor1
parents:
diff changeset
1625 v3 = GetActualAttack(true);
Ritor1
parents:
diff changeset
1626 }
Ritor1
parents:
diff changeset
1627 return v3;
Ritor1
parents:
diff changeset
1628 }
Ritor1
parents:
diff changeset
1629
Ritor1
parents:
diff changeset
1630 //----- (0048D124) --------------------------------------------------------
Ritor1
parents:
diff changeset
1631 int Player::GetRangedDamageMin()
Ritor1
parents:
diff changeset
1632 {
Ritor1
parents:
diff changeset
1633 int v2; // edi@1
Ritor1
parents:
diff changeset
1634 int v3; // edi@1
Ritor1
parents:
diff changeset
1635 int v4; // edi@1
Ritor1
parents:
diff changeset
1636 int result; // eax@6
Ritor1
parents:
diff changeset
1637
Ritor1
parents:
diff changeset
1638 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MIN);
Ritor1
parents:
diff changeset
1639 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
Ritor1
parents:
diff changeset
1640 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
Ritor1
parents:
diff changeset
1641 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
1642 result = v4;
Ritor1
parents:
diff changeset
1643 else
Ritor1
parents:
diff changeset
1644 result = 0;
Ritor1
parents:
diff changeset
1645 return result;
Ritor1
parents:
diff changeset
1646 }
Ritor1
parents:
diff changeset
1647
Ritor1
parents:
diff changeset
1648 //----- (0048D191) --------------------------------------------------------
Ritor1
parents:
diff changeset
1649 int Player::GetRangedDamageMax()
Ritor1
parents:
diff changeset
1650 {
Ritor1
parents:
diff changeset
1651 int v2; // edi@1
Ritor1
parents:
diff changeset
1652 int v3; // edi@1
Ritor1
parents:
diff changeset
1653 int v4; // edi@1
Ritor1
parents:
diff changeset
1654 int result; // eax@6
Ritor1
parents:
diff changeset
1655
Ritor1
parents:
diff changeset
1656 v2 = GetItemsBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_MAX);
Ritor1
parents:
diff changeset
1657 v3 = GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v2;
Ritor1
parents:
diff changeset
1658 v4 = this->_ranged_dmg_bonus + GetMagicalBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS) + v3;
Ritor1
parents:
diff changeset
1659 if ( v4 >= 1 )
Ritor1
parents:
diff changeset
1660 result = v4;
Ritor1
parents:
diff changeset
1661 else
Ritor1
parents:
diff changeset
1662 result = 0;
Ritor1
parents:
diff changeset
1663 return result;
Ritor1
parents:
diff changeset
1664 }
Ritor1
parents:
diff changeset
1665
Ritor1
parents:
diff changeset
1666 //----- (0048D1FE) --------------------------------------------------------
Ritor1
parents:
diff changeset
1667 int Player::CalculateRangedDamageTo( int a2 )
Ritor1
parents:
diff changeset
1668 {
Ritor1
parents:
diff changeset
1669 ItemGen *v4; // ebx@2
Ritor1
parents:
diff changeset
1670 unsigned int v5; // edi@2
Ritor1
parents:
diff changeset
1671 int v9; // esi@5
Ritor1
parents:
diff changeset
1672 int v10; // ebx@6
Ritor1
parents:
diff changeset
1673 signed int v15; // [sp+8h] [bp-Ch]@2
Ritor1
parents:
diff changeset
1674 int v17; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1675
Ritor1
parents:
diff changeset
1676 v17 = 0;
Ritor1
parents:
diff changeset
1677 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
1678 return 0;
Ritor1
parents:
diff changeset
1679 v4 = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uBow-1];
Ritor1
parents:
diff changeset
1680 v5 = v4->uItemID;
Ritor1
parents:
diff changeset
1681 v15 = pItemsTable->pItems[v5].uDamageRoll;
Ritor1
parents:
diff changeset
1682 for( int i = 0; i < pItemsTable->pItems[v5].uDamageDice; i++ )
Ritor1
parents:
diff changeset
1683 {
Ritor1
parents:
diff changeset
1684 int v7 = rand() % v15;
Ritor1
parents:
diff changeset
1685 v17 += v7 + 1;
Ritor1
parents:
diff changeset
1686 }
Ritor1
parents:
diff changeset
1687 v9 = pItemsTable->pItems[v5].uDamageMod + v17;
Ritor1
parents:
diff changeset
1688 if ( a2 )
Ritor1
parents:
diff changeset
1689 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
1690 v10 = v4->special_enchantment;
2498
Ritor1
parents:
diff changeset
1691 if ( v10 == 64 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_UNDEAD))
Ritor1
parents:
diff changeset
1692 {
Ritor1
parents:
diff changeset
1693 v9 *= 2;
Ritor1
parents:
diff changeset
1694 }
Ritor1
parents:
diff changeset
1695 else if ( v10 == 39 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_KREEGAN))
Ritor1
parents:
diff changeset
1696 {
Ritor1
parents:
diff changeset
1697 v9 *= 2;
Ritor1
parents:
diff changeset
1698 }
Ritor1
parents:
diff changeset
1699 else if ( v10 == 40 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_DRAGON))
Ritor1
parents:
diff changeset
1700 {
Ritor1
parents:
diff changeset
1701 v9 *= 2;
Ritor1
parents:
diff changeset
1702 }
Ritor1
parents:
diff changeset
1703 else if ( v10 == 63 && MonsterStats::BelongsToSupertype(a2, MONSTER_SUPERTYPE_ELF))
Ritor1
parents:
diff changeset
1704 {
Ritor1
parents:
diff changeset
1705 v9 *= 2;
Ritor1
parents:
diff changeset
1706 }
Ritor1
parents:
diff changeset
1707 }
Ritor1
parents:
diff changeset
1708 return v9 + this->GetSkillBonus(CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS);
Ritor1
parents:
diff changeset
1709 }
Ritor1
parents:
diff changeset
1710
Ritor1
parents:
diff changeset
1711 //----- (0048D2EA) --------------------------------------------------------
Ritor1
parents:
diff changeset
1712 char *Player::GetMeleeDamageString()
Ritor1
parents:
diff changeset
1713 {
Ritor1
parents:
diff changeset
1714 int min_damage; // edi@3
Ritor1
parents:
diff changeset
1715 int max_damage; // eax@3
Ritor1
parents:
diff changeset
1716
Ritor1
parents:
diff changeset
1717 static char player__getmeleedamagestring_static_buff[40]; // idb
Ritor1
parents:
diff changeset
1718
Ritor1
parents:
diff changeset
1719 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1720
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
1721 if (mainHandItem != nullptr && (mainHandItem->uItemID >= ITEM_WAND_FIRE) && (mainHandItem->uItemID <= ITEM_WAND_INCENERATION))
2498
Ritor1
parents:
diff changeset
1722 {
Ritor1
parents:
diff changeset
1723 strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
Ritor1
parents:
diff changeset
1724 return player__getmeleedamagestring_static_buff;
Ritor1
parents:
diff changeset
1725 }
Ritor1
parents:
diff changeset
1726 else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE))
Ritor1
parents:
diff changeset
1727 {
Ritor1
parents:
diff changeset
1728 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
Ritor1
parents:
diff changeset
1729 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
Ritor1
parents:
diff changeset
1730 }
Ritor1
parents:
diff changeset
1731 else
Ritor1
parents:
diff changeset
1732 {
Ritor1
parents:
diff changeset
1733 min_damage = GetMeleeDamageMinimal();
Ritor1
parents:
diff changeset
1734 max_damage = GetMeleeDamageMaximal();
Ritor1
parents:
diff changeset
1735 }
Ritor1
parents:
diff changeset
1736 if ( min_damage == max_damage )
Ritor1
parents:
diff changeset
1737 {
Ritor1
parents:
diff changeset
1738 sprintf(player__getmeleedamagestring_static_buff, "%d", min_damage);
Ritor1
parents:
diff changeset
1739 }
Ritor1
parents:
diff changeset
1740 else
Ritor1
parents:
diff changeset
1741 {
Ritor1
parents:
diff changeset
1742 sprintf(player__getmeleedamagestring_static_buff, "%d - %d", min_damage, max_damage);
Ritor1
parents:
diff changeset
1743 }
Ritor1
parents:
diff changeset
1744 return player__getmeleedamagestring_static_buff;
Ritor1
parents:
diff changeset
1745 }
Ritor1
parents:
diff changeset
1746
Ritor1
parents:
diff changeset
1747 //----- (0048D396) --------------------------------------------------------
Ritor1
parents:
diff changeset
1748 char *Player::GetRangedDamageString()
Ritor1
parents:
diff changeset
1749 {
Ritor1
parents:
diff changeset
1750 int min_damage; // edi@3
Ritor1
parents:
diff changeset
1751 int max_damage; // eax@3
Ritor1
parents:
diff changeset
1752
Ritor1
parents:
diff changeset
1753 static char player__getrangeddamagestring_static_buff[40]; // idb
Ritor1
parents:
diff changeset
1754
Ritor1
parents:
diff changeset
1755 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
1756
Ritor1
parents:
diff changeset
1757 if (mainHandItem != nullptr && ( mainHandItem->uItemID >= 135 ) && ( mainHandItem->uItemID <= 159 ))
Ritor1
parents:
diff changeset
1758 {
Ritor1
parents:
diff changeset
1759 strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand"
Ritor1
parents:
diff changeset
1760 return player__getrangeddamagestring_static_buff;
Ritor1
parents:
diff changeset
1761 }
Ritor1
parents:
diff changeset
1762 else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE))
Ritor1
parents:
diff changeset
1763 {
Ritor1
parents:
diff changeset
1764 min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true);
Ritor1
parents:
diff changeset
1765 max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true);
Ritor1
parents:
diff changeset
1766 }
Ritor1
parents:
diff changeset
1767 else
Ritor1
parents:
diff changeset
1768 {
Ritor1
parents:
diff changeset
1769 min_damage = GetRangedDamageMin();
Ritor1
parents:
diff changeset
1770 max_damage = GetRangedDamageMax();
Ritor1
parents:
diff changeset
1771 }
Ritor1
parents:
diff changeset
1772 if ( max_damage > 0)
Ritor1
parents:
diff changeset
1773 {
Ritor1
parents:
diff changeset
1774 if ( min_damage == max_damage )
Ritor1
parents:
diff changeset
1775 {
Ritor1
parents:
diff changeset
1776 sprintf(player__getrangeddamagestring_static_buff, "%d", min_damage);
Ritor1
parents:
diff changeset
1777 }
Ritor1
parents:
diff changeset
1778 else
Ritor1
parents:
diff changeset
1779 {
Ritor1
parents:
diff changeset
1780 sprintf(player__getrangeddamagestring_static_buff, "%d - %d", min_damage, max_damage);
Ritor1
parents:
diff changeset
1781 }
Ritor1
parents:
diff changeset
1782 }
Ritor1
parents:
diff changeset
1783 else
Ritor1
parents:
diff changeset
1784 {
Ritor1
parents:
diff changeset
1785 strcpy(player__getrangeddamagestring_static_buff, "N/A");
Ritor1
parents:
diff changeset
1786 }
Ritor1
parents:
diff changeset
1787 return player__getrangeddamagestring_static_buff;
Ritor1
parents:
diff changeset
1788 }
Ritor1
parents:
diff changeset
1789
Ritor1
parents:
diff changeset
1790 //----- (0048D45A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1791 bool Player::CanTrainToNextLevel()
Ritor1
parents:
diff changeset
1792 {
Ritor1
parents:
diff changeset
1793 int lvl = this->uLevel + 1;
Ritor1
parents:
diff changeset
1794 int neededExp = ((lvl * (lvl - 1)) / 2 * 1000);
Ritor1
parents:
diff changeset
1795 return this->uExperience >= neededExp;
Ritor1
parents:
diff changeset
1796 }
Ritor1
parents:
diff changeset
1797
Ritor1
parents:
diff changeset
1798 //----- (0048D498) --------------------------------------------------------
Ritor1
parents:
diff changeset
1799 unsigned int Player::GetExperienceDisplayColor()
Ritor1
parents:
diff changeset
1800 {
Ritor1
parents:
diff changeset
1801 if ( CanTrainToNextLevel() )
Ritor1
parents:
diff changeset
1802 return ui_character_bonus_text_color;
Ritor1
parents:
diff changeset
1803 else
Ritor1
parents:
diff changeset
1804 return ui_character_default_text_color;
Ritor1
parents:
diff changeset
1805 }
Ritor1
parents:
diff changeset
1806
Ritor1
parents:
diff changeset
1807 //----- (0048D4B3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1808 int Player::CalculateIncommingDamage( DAMAGE_TYPE dmg_type, int dmg )
Ritor1
parents:
diff changeset
1809 {
Ritor1
parents:
diff changeset
1810 int resist_value; // edi@8
Ritor1
parents:
diff changeset
1811 int player_luck; // eax@21
Ritor1
parents:
diff changeset
1812 signed int res_rand_divider; // ebx@2
Ritor1
parents:
diff changeset
1813 int armor_skill; // eax@29
Ritor1
parents:
diff changeset
1814
Ritor1
parents:
diff changeset
1815 if ( classType == PLAYER_CLASS_LICH && (dmg_type == CHARACTER_ATTRIBUTE_RESIST_MIND || dmg_type == CHARACTER_ATTRIBUTE_RESIST_BODY || dmg_type == CHARACTER_ATTRIBUTE_RESIST_SPIRIT )) //TODO: determine if spirit resistance should be handled by body res. modifier
Ritor1
parents:
diff changeset
1816 return 0;
Ritor1
parents:
diff changeset
1817
Ritor1
parents:
diff changeset
1818 resist_value = 0;
Ritor1
parents:
diff changeset
1819 switch(dmg_type)
Ritor1
parents:
diff changeset
1820 {
Ritor1
parents:
diff changeset
1821 case DMGT_FIRE: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); break;
Ritor1
parents:
diff changeset
1822 case DMGT_ELECTR: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); break;
Ritor1
parents:
diff changeset
1823 case DMGT_COLD: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); break;
Ritor1
parents:
diff changeset
1824 case DMGT_EARTH: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); break;
Ritor1
parents:
diff changeset
1825
Ritor1
parents:
diff changeset
1826 case DMGT_SPIRIT: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_SPIRIT);break;
Ritor1
parents:
diff changeset
1827 case DMGT_MIND: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); break;
Ritor1
parents:
diff changeset
1828 case DMGT_BODY: resist_value = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); break;
Ritor1
parents:
diff changeset
1829 }
Ritor1
parents:
diff changeset
1830
Ritor1
parents:
diff changeset
1831 player_luck = GetActualLuck();
Ritor1
parents:
diff changeset
1832 res_rand_divider = GetParameterBonus(player_luck) + resist_value + 30;
Ritor1
parents:
diff changeset
1833
Ritor1
parents:
diff changeset
1834 if ( GetParameterBonus(player_luck) + resist_value > 0 )
Ritor1
parents:
diff changeset
1835 {
Ritor1
parents:
diff changeset
1836 for (int i = 0; i < 4; i++)
Ritor1
parents:
diff changeset
1837 {
Ritor1
parents:
diff changeset
1838 if ( rand() % res_rand_divider >= 30 )
Ritor1
parents:
diff changeset
1839 dmg >>= 1;
Ritor1
parents:
diff changeset
1840 else
Ritor1
parents:
diff changeset
1841 break;
Ritor1
parents:
diff changeset
1842 }
Ritor1
parents:
diff changeset
1843 }
Ritor1
parents:
diff changeset
1844 ItemGen* equippedArmor = GetArmorItem();
Ritor1
parents:
diff changeset
1845 if (( dmg_type == DMGT_PHISYCAL ) && ( equippedArmor != nullptr ))
Ritor1
parents:
diff changeset
1846 {
Ritor1
parents:
diff changeset
1847 if (!equippedArmor->IsBroken())
Ritor1
parents:
diff changeset
1848 {
Ritor1
parents:
diff changeset
1849 armor_skill = equippedArmor->GetPlayerSkillType();
Ritor1
parents:
diff changeset
1850 if ( armor_skill==PLAYER_SKILL_PLATE )
Ritor1
parents:
diff changeset
1851 {
Ritor1
parents:
diff changeset
1852 if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 )
Ritor1
parents:
diff changeset
1853 return dmg / 2;
Ritor1
parents:
diff changeset
1854 }
Ritor1
parents:
diff changeset
1855 if (armor_skill==PLAYER_SKILL_CHAIN )
Ritor1
parents:
diff changeset
1856 {
Ritor1
parents:
diff changeset
1857 if (SkillToMastery(pActiveSkills[PLAYER_SKILL_CHAIN]) == 4)
Ritor1
parents:
diff changeset
1858 return dmg * 2 / 3;
Ritor1
parents:
diff changeset
1859 }
Ritor1
parents:
diff changeset
1860 }
Ritor1
parents:
diff changeset
1861 }
Ritor1
parents:
diff changeset
1862 return dmg;
Ritor1
parents:
diff changeset
1863 }
Ritor1
parents:
diff changeset
1864
Ritor1
parents:
diff changeset
1865 //----- (0048D62C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1866 ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot)
Ritor1
parents:
diff changeset
1867 {
Ritor1
parents:
diff changeset
1868 return GetNthEquippedIndexItem(uEquipSlot)->GetItemEquipType();
Ritor1
parents:
diff changeset
1869 }
Ritor1
parents:
diff changeset
1870
Ritor1
parents:
diff changeset
1871 //----- (0048D651) --------------------------------------------------------
Ritor1
parents:
diff changeset
1872 PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot)
Ritor1
parents:
diff changeset
1873 {
Ritor1
parents:
diff changeset
1874 return (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(uEquipSlot)->GetPlayerSkillType();
Ritor1
parents:
diff changeset
1875 }
Ritor1
parents:
diff changeset
1876
Ritor1
parents:
diff changeset
1877 //----- (0048D676) --------------------------------------------------------
Ritor1
parents:
diff changeset
1878 bool Player::IsUnarmed()
Ritor1
parents:
diff changeset
1879 {
Ritor1
parents:
diff changeset
1880 return !HasItemEquipped(EQUIP_TWO_HANDED) &&
Ritor1
parents:
diff changeset
1881 (!HasItemEquipped(EQUIP_SINGLE_HANDED) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD);
Ritor1
parents:
diff changeset
1882 }
Ritor1
parents:
diff changeset
1883
Ritor1
parents:
diff changeset
1884 //----- (0048D6AA) --------------------------------------------------------
Ritor1
parents:
diff changeset
1885 bool Player::HasItemEquipped(ITEM_EQUIP_TYPE uEquipIndex)
Ritor1
parents:
diff changeset
1886 {
Ritor1
parents:
diff changeset
1887 uint i = pEquipment.pIndices[uEquipIndex];
Ritor1
parents:
diff changeset
1888 if (i)
Ritor1
parents:
diff changeset
1889 return !pOwnItems[i - 1].IsBroken();
Ritor1
parents:
diff changeset
1890 else
Ritor1
parents:
diff changeset
1891 return false;
Ritor1
parents:
diff changeset
1892 }
Ritor1
parents:
diff changeset
1893
Ritor1
parents:
diff changeset
1894 //----- (0048D6D0) --------------------------------------------------------
Ritor1
parents:
diff changeset
1895 bool Player::HasEnchantedItemEquipped(int uEnchantment)
Ritor1
parents:
diff changeset
1896 {
Ritor1
parents:
diff changeset
1897 for (uint i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
1898 {
Ritor1
parents:
diff changeset
1899 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
1900 GetNthEquippedIndexItem(i)->special_enchantment == uEnchantment)
2498
Ritor1
parents:
diff changeset
1901 return true;
Ritor1
parents:
diff changeset
1902 }
Ritor1
parents:
diff changeset
1903 return false;
Ritor1
parents:
diff changeset
1904 }
Ritor1
parents:
diff changeset
1905
Ritor1
parents:
diff changeset
1906 //----- (0048D709) --------------------------------------------------------
Ritor1
parents:
diff changeset
1907 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type )
Ritor1
parents:
diff changeset
1908 {
Ritor1
parents:
diff changeset
1909 return ( HasItemEquipped(equip_type) && GetNthEquippedIndexItem(equip_type)->uItemID == item_id );
Ritor1
parents:
diff changeset
1910 }
Ritor1
parents:
diff changeset
1911
Ritor1
parents:
diff changeset
1912 bool Player::WearsItemAnyWhere(int item_id)
Ritor1
parents:
diff changeset
1913 {
Ritor1
parents:
diff changeset
1914 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
1915 {
Ritor1
parents:
diff changeset
1916 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i))
Ritor1
parents:
diff changeset
1917 {
Ritor1
parents:
diff changeset
1918 return true;
Ritor1
parents:
diff changeset
1919 }
Ritor1
parents:
diff changeset
1920 }
Ritor1
parents:
diff changeset
1921 return false;
Ritor1
parents:
diff changeset
1922 }
Ritor1
parents:
diff changeset
1923
Ritor1
parents:
diff changeset
1924 //----- (0048D76C) --------------------------------------------------------
Ritor1
parents:
diff changeset
1925 int Player::StealFromShop( ItemGen *itemToSteal, int extraStealDifficulty, int reputation, int a5, int *fineIfFailed ) //returns an int, but is the return value is compared to zero, so might change to bool
Ritor1
parents:
diff changeset
1926 {
Ritor1
parents:
diff changeset
1927 unsigned __int16 v6; // cx@8
Ritor1
parents:
diff changeset
1928 int v7; // edi@8
Ritor1
parents:
diff changeset
1929 unsigned int v8; // ebx@8
Ritor1
parents:
diff changeset
1930 unsigned int itemvalue; // esi@8
Ritor1
parents:
diff changeset
1931 int v10; // eax@8
Ritor1
parents:
diff changeset
1932 int currMaxItemValue; // edi@12
Ritor1
parents:
diff changeset
1933
Ritor1
parents:
diff changeset
1934 if ( !itemToSteal
Ritor1
parents:
diff changeset
1935 || this->IsEradicated()
Ritor1
parents:
diff changeset
1936 || this->IsDead()
Ritor1
parents:
diff changeset
1937 || this->IsPertified()
Ritor1
parents:
diff changeset
1938 || this->IsDrunk()
Ritor1
parents:
diff changeset
1939 || this->IsUnconcious()
Ritor1
parents:
diff changeset
1940 || this->IsAsleep() )
Ritor1
parents:
diff changeset
1941 {
Ritor1
parents:
diff changeset
1942 return 0;
Ritor1
parents:
diff changeset
1943 }
Ritor1
parents:
diff changeset
1944 else
Ritor1
parents:
diff changeset
1945 {
Ritor1
parents:
diff changeset
1946 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING];
Ritor1
parents:
diff changeset
1947 v7 = v6 & 0x3F;
Ritor1
parents:
diff changeset
1948 v8 = SkillToMastery(v6);
Ritor1
parents:
diff changeset
1949 itemvalue = itemToSteal->GetValue();
Ritor1
parents:
diff changeset
1950 v10 = itemToSteal->GetItemEquipType();
Ritor1
parents:
diff changeset
1951 if ( v10 == EQUIP_SINGLE_HANDED || v10 == EQUIP_TWO_HANDED || v10 == EQUIP_BOW )
Ritor1
parents:
diff changeset
1952 itemvalue *= 3;
Ritor1
parents:
diff changeset
1953 currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8];
Ritor1
parents:
diff changeset
1954 *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue;
Ritor1
parents:
diff changeset
1955 if (a5)
Ritor1
parents:
diff changeset
1956 {
Ritor1
parents:
diff changeset
1957 *fineIfFailed += 500;
Ritor1
parents:
diff changeset
1958 }
Ritor1
parents:
diff changeset
1959 if ( rand() % 100 >= 5 )
Ritor1
parents:
diff changeset
1960 {
Ritor1
parents:
diff changeset
1961 if ( *fineIfFailed > currMaxItemValue )
Ritor1
parents:
diff changeset
1962 if (*fineIfFailed - currMaxItemValue < 500)
Ritor1
parents:
diff changeset
1963 {
Ritor1
parents:
diff changeset
1964 return 1;
Ritor1
parents:
diff changeset
1965 }
Ritor1
parents:
diff changeset
1966 else
Ritor1
parents:
diff changeset
1967 {
Ritor1
parents:
diff changeset
1968 return 0;
Ritor1
parents:
diff changeset
1969 }
Ritor1
parents:
diff changeset
1970 else
Ritor1
parents:
diff changeset
1971 return 2;
Ritor1
parents:
diff changeset
1972 }
Ritor1
parents:
diff changeset
1973 else
Ritor1
parents:
diff changeset
1974 {
Ritor1
parents:
diff changeset
1975 return 0;
Ritor1
parents:
diff changeset
1976 }
Ritor1
parents:
diff changeset
1977 }
Ritor1
parents:
diff changeset
1978 }
Ritor1
parents:
diff changeset
1979
Ritor1
parents:
diff changeset
1980 //----- (0048D88B) --------------------------------------------------------
Ritor1
parents:
diff changeset
1981 int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation)
Ritor1
parents:
diff changeset
1982 {
Ritor1
parents:
diff changeset
1983 Actor *actroPtr; // edi@1
Ritor1
parents:
diff changeset
1984 int v7; // ebx@10
Ritor1
parents:
diff changeset
1985 unsigned int stealingMastery; // esi@10
Ritor1
parents:
diff changeset
1986 int fineIfFailed; // esi@10
Ritor1
parents:
diff changeset
1987 int v11; // eax@13
Ritor1
parents:
diff changeset
1988 bool HasFullItemSlots; // ebx@15
Ritor1
parents:
diff changeset
1989 unsigned __int16 carriedItemId; // si@21
Ritor1
parents:
diff changeset
1990 unsigned int enchBonusSum; // esi@31
Ritor1
parents:
diff changeset
1991 int *enchTypePtr; // eax@34
Ritor1
parents:
diff changeset
1992 ItemGen tempItem; // [sp+8h] [bp-34h]@15
Ritor1
parents:
diff changeset
1993 int currMaxItemValue;
Ritor1
parents:
diff changeset
1994
Ritor1
parents:
diff changeset
1995 actroPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
1996 if ( !actroPtr
Ritor1
parents:
diff changeset
1997 || this->IsEradicated()
Ritor1
parents:
diff changeset
1998 || this->IsDead()
Ritor1
parents:
diff changeset
1999 || this->IsPertified()
Ritor1
parents:
diff changeset
2000 || this->IsDrunk()
Ritor1
parents:
diff changeset
2001 || this->IsUnconcious()
Ritor1
parents:
diff changeset
2002 || this->IsAsleep() )
Ritor1
parents:
diff changeset
2003 {
Ritor1
parents:
diff changeset
2004 return 0;
Ritor1
parents:
diff changeset
2005 }
Ritor1
parents:
diff changeset
2006 if ( !actroPtr->ActorHasItem() )
Ritor1
parents:
diff changeset
2007 actroPtr->SetRandomGoldIfTheresNoItem();
Ritor1
parents:
diff changeset
2008 unsigned __int16 v6 = this->pActiveSkills[PLAYER_SKILL_STEALING];
Ritor1
parents:
diff changeset
2009 v7 = v6 & 0x3F;
Ritor1
parents:
diff changeset
2010 stealingMastery = SkillToMastery(v6);
Ritor1
parents:
diff changeset
2011 int v30 = StealingMasteryBonuses[stealingMastery];
Ritor1
parents:
diff changeset
2012 int v29 = StealingRandomBonuses[rand() % 5];
Ritor1
parents:
diff changeset
2013 fineIfFailed = actroPtr->pMonsterInfo.uLevel + 100 * (_steal_perm + reputation);
Ritor1
parents:
diff changeset
2014 currMaxItemValue = v29 + v7 * v30;
Ritor1
parents:
diff changeset
2015 if ( rand() % 100 < 5 || fineIfFailed > currMaxItemValue || actroPtr->ActorEnemy() )
Ritor1
parents:
diff changeset
2016 {
Ritor1
parents:
diff changeset
2017 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
2018 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[376], this->pName);//"%s was caught stealing!"
Ritor1
parents:
diff changeset
2019 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2020 return 0;
Ritor1
parents:
diff changeset
2021 }
Ritor1
parents:
diff changeset
2022 else
Ritor1
parents:
diff changeset
2023 {
Ritor1
parents:
diff changeset
2024 v11 = rand();
Ritor1
parents:
diff changeset
2025 if ( v11 % 100 >= 70 ) //stealing gold
Ritor1
parents:
diff changeset
2026 {
Ritor1
parents:
diff changeset
2027 enchBonusSum = 0;
Ritor1
parents:
diff changeset
2028 for (int i = 0; i < v7; i++)
Ritor1
parents:
diff changeset
2029 enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1;
Ritor1
parents:
diff changeset
2030 if ( actroPtr->ActorHasItems[3].GetItemEquipType() != EQUIP_GOLD )
Ritor1
parents:
diff changeset
2031 return 2;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2032 enchTypePtr = (int *)&actroPtr->ActorHasItems[3].special_enchantment;
2498
Ritor1
parents:
diff changeset
2033 if ( (int)enchBonusSum >= *enchTypePtr )
Ritor1
parents:
diff changeset
2034 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2035 actroPtr->ActorHasItems[3].uItemID = ITEM_NULL;
2498
Ritor1
parents:
diff changeset
2036 *enchTypePtr = 0;
Ritor1
parents:
diff changeset
2037 }
Ritor1
parents:
diff changeset
2038 else
Ritor1
parents:
diff changeset
2039 *enchTypePtr -= enchBonusSum;
Ritor1
parents:
diff changeset
2040 if ( enchBonusSum )
Ritor1
parents:
diff changeset
2041 {
Ritor1
parents:
diff changeset
2042 pParty->PartyFindsGold(enchBonusSum, 2);
Ritor1
parents:
diff changeset
2043 sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], this->pName, enchBonusSum); //%stole %d gold
Ritor1
parents:
diff changeset
2044 }
Ritor1
parents:
diff changeset
2045 else
Ritor1
parents:
diff changeset
2046 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything
Ritor1
parents:
diff changeset
2047 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2048 return 2;
Ritor1
parents:
diff changeset
2049 }
Ritor1
parents:
diff changeset
2050 else if ( v11 % 100 >= 40 ) //stealing an item
Ritor1
parents:
diff changeset
2051 {
Ritor1
parents:
diff changeset
2052 tempItem.Reset();
Ritor1
parents:
diff changeset
2053 HasFullItemSlots = false;
Ritor1
parents:
diff changeset
2054 int i;
Ritor1
parents:
diff changeset
2055 for (i = 0; i < 4; i++)
Ritor1
parents:
diff changeset
2056 {
Ritor1
parents:
diff changeset
2057 if ( actroPtr->ActorHasItems[i].uItemID != 0 && actroPtr->ActorHasItems[i].GetItemEquipType() != EQUIP_GOLD )
Ritor1
parents:
diff changeset
2058 break;
Ritor1
parents:
diff changeset
2059 }
Ritor1
parents:
diff changeset
2060 if (i == 4)
Ritor1
parents:
diff changeset
2061 HasFullItemSlots = true;
Ritor1
parents:
diff changeset
2062 carriedItemId = actroPtr->uCarriedItemID;
Ritor1
parents:
diff changeset
2063 if ( carriedItemId != 0 || HasFullItemSlots )
Ritor1
parents:
diff changeset
2064 {
Ritor1
parents:
diff changeset
2065 tempItem.Reset();
Ritor1
parents:
diff changeset
2066 if ( carriedItemId != 0 )
Ritor1
parents:
diff changeset
2067 {
Ritor1
parents:
diff changeset
2068 actroPtr->uCarriedItemID = 0;
Ritor1
parents:
diff changeset
2069 tempItem.uItemID = carriedItemId;
Ritor1
parents:
diff changeset
2070 if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_WAND )
Ritor1
parents:
diff changeset
2071 tempItem.uNumCharges = rand() % 6 + pItemsTable->pItems[carriedItemId].uDamageMod + 1;
Ritor1
parents:
diff changeset
2072 else if ( pItemsTable->pItems[carriedItemId].uEquipType == EQUIP_POTION && carriedItemId != ITEM_POTION_BOTTLE)
Ritor1
parents:
diff changeset
2073 tempItem.uEnchantmentType = 2 * rand() % 4 + 2;
Ritor1
parents:
diff changeset
2074 }
Ritor1
parents:
diff changeset
2075 else
Ritor1
parents:
diff changeset
2076 {
Ritor1
parents:
diff changeset
2077 ItemGen* itemToSteal = &actroPtr->ActorHasItems[rand() % 4];
Ritor1
parents:
diff changeset
2078 memcpy(&tempItem, itemToSteal, sizeof(tempItem));
Ritor1
parents:
diff changeset
2079 itemToSteal->Reset();
Ritor1
parents:
diff changeset
2080 carriedItemId = tempItem.uItemID;
Ritor1
parents:
diff changeset
2081 }
Ritor1
parents:
diff changeset
2082 if (carriedItemId != 0) // looks odd in current context, but avoids accessing zeroth element of pItemsTable->pItems
Ritor1
parents:
diff changeset
2083 {
Ritor1
parents:
diff changeset
2084 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
2085 sprintf(
Ritor1
parents:
diff changeset
2086 pTmpBuf2.data(),
Ritor1
parents:
diff changeset
2087 pGlobalTXT_LocalizationStrings[304], // Official //TODO: add a normal "%d stole %d" message
Ritor1
parents:
diff changeset
2088 this->pName,
Ritor1
parents:
diff changeset
2089 pItemsTable->pItems[carriedItemId].pUnidentifiedName);
Ritor1
parents:
diff changeset
2090 ShowStatusBarString(pTmpBuf2.data(), 2u);
Ritor1
parents:
diff changeset
2091 pParty->sub_421B2C_PlaceInInventory_or_DropPickedItem();
Ritor1
parents:
diff changeset
2092 memcpy(&pParty->pPickedItem, &tempItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
2093 pMouse->SetCursorBitmapFromItemID(carriedItemId);
Ritor1
parents:
diff changeset
2094 return 2;
Ritor1
parents:
diff changeset
2095 }
Ritor1
parents:
diff changeset
2096 }
Ritor1
parents:
diff changeset
2097 }
Ritor1
parents:
diff changeset
2098 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything
Ritor1
parents:
diff changeset
2099 ShowStatusBarString(pTmpBuf2.data(), 2);
Ritor1
parents:
diff changeset
2100 return 2;
Ritor1
parents:
diff changeset
2101 }
Ritor1
parents:
diff changeset
2102 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2103
2498
Ritor1
parents:
diff changeset
2104
Ritor1
parents:
diff changeset
2105 //----- (0048DBB9) --------------------------------------------------------
Ritor1
parents:
diff changeset
2106 void Player::Heal(int amount)
Ritor1
parents:
diff changeset
2107 {
Ritor1
parents:
diff changeset
2108 signed int max_health; // eax@3
Ritor1
parents:
diff changeset
2109
Ritor1
parents:
diff changeset
2110 if ( !IsEradicated() && !IsDead() )
Ritor1
parents:
diff changeset
2111 {
Ritor1
parents:
diff changeset
2112 max_health = GetMaxHealth();
Ritor1
parents:
diff changeset
2113 if ( IsZombie() )
Ritor1
parents:
diff changeset
2114 max_health /= 2;
Ritor1
parents:
diff changeset
2115 sHealth += amount;
Ritor1
parents:
diff changeset
2116 if ( sHealth > max_health )
Ritor1
parents:
diff changeset
2117 sHealth = max_health;
Ritor1
parents:
diff changeset
2118 if ( IsUnconcious() )
Ritor1
parents:
diff changeset
2119 {
Ritor1
parents:
diff changeset
2120 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
2121 {
Ritor1
parents:
diff changeset
2122 SetUnconcious(false);
Ritor1
parents:
diff changeset
2123 }
Ritor1
parents:
diff changeset
2124 }
Ritor1
parents:
diff changeset
2125 }
Ritor1
parents:
diff changeset
2126 }
Ritor1
parents:
diff changeset
2127
Ritor1
parents:
diff changeset
2128 //----- (0048DC1E) --------------------------------------------------------
Ritor1
parents:
diff changeset
2129 int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type )
Ritor1
parents:
diff changeset
2130 {
Ritor1
parents:
diff changeset
2131 signed int recieved_dmg; // eax@1
Ritor1
parents:
diff changeset
2132 bool broke_armor;
Ritor1
parents:
diff changeset
2133
Ritor1
parents:
diff changeset
2134 SetAsleep(false);
Ritor1
parents:
diff changeset
2135 recieved_dmg = CalculateIncommingDamage(dmg_type, amount);
Ritor1
parents:
diff changeset
2136 sHealth -= recieved_dmg;
Ritor1
parents:
diff changeset
2137 broke_armor = sHealth <= -10;
Ritor1
parents:
diff changeset
2138 if ( sHealth < 1 ) //
Ritor1
parents:
diff changeset
2139 {
Ritor1
parents:
diff changeset
2140 if ( (sHealth + uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1)
Ritor1
parents:
diff changeset
2141 || pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2142 {
Ritor1
parents:
diff changeset
2143 SetCondUnconsciousWithBlockCheck(false);
Ritor1
parents:
diff changeset
2144 }
Ritor1
parents:
diff changeset
2145 else
Ritor1
parents:
diff changeset
2146 {
Ritor1
parents:
diff changeset
2147 SetCondDeadWithBlockCheck(false);
Ritor1
parents:
diff changeset
2148 if ( sHealth > 0 )
Ritor1
parents:
diff changeset
2149 sHealth = 0;
Ritor1
parents:
diff changeset
2150 }
Ritor1
parents:
diff changeset
2151 if (broke_armor )
Ritor1
parents:
diff changeset
2152 {
Ritor1
parents:
diff changeset
2153 ItemGen* equippedArmor = GetArmorItem();
Ritor1
parents:
diff changeset
2154 if ( equippedArmor != nullptr )
Ritor1
parents:
diff changeset
2155 {
Ritor1
parents:
diff changeset
2156 if ( !(equippedArmor->uAttributes & ITEM_HARDENED))
Ritor1
parents:
diff changeset
2157 {
Ritor1
parents:
diff changeset
2158 equippedArmor->SetBroken();
Ritor1
parents:
diff changeset
2159 }
Ritor1
parents:
diff changeset
2160 }
Ritor1
parents:
diff changeset
2161 }
Ritor1
parents:
diff changeset
2162 }
Ritor1
parents:
diff changeset
2163 if ( recieved_dmg && CanAct() )
Ritor1
parents:
diff changeset
2164 PlaySound(SPEECH_24, 0);
Ritor1
parents:
diff changeset
2165 return recieved_dmg;
Ritor1
parents:
diff changeset
2166 }
Ritor1
parents:
diff changeset
2167
Ritor1
parents:
diff changeset
2168 //----- (0048DCF6) --------------------------------------------------------
Ritor1
parents:
diff changeset
2169 int Player::ReceiveSpecialAttackEffect( int attType, struct Actor *pActor )
Ritor1
parents:
diff changeset
2170 {
Ritor1
parents:
diff changeset
2171 SPECIAL_ATTACK_TYPE attTypeCast = (SPECIAL_ATTACK_TYPE) attType;
Ritor1
parents:
diff changeset
2172 signed int v3; // edi@1
Ritor1
parents:
diff changeset
2173 signed int v4; // ebx@1
Ritor1
parents:
diff changeset
2174 int v6; // eax@2
Ritor1
parents:
diff changeset
2175 int v8; // eax@8
Ritor1
parents:
diff changeset
2176 int v10; // eax@8
Ritor1
parents:
diff changeset
2177 int v11; // ebx@8
Ritor1
parents:
diff changeset
2178 ItemGen *v13; // eax@9
Ritor1
parents:
diff changeset
2179 int v22; // eax@49
Ritor1
parents:
diff changeset
2180 signed int v23; // ebx@49
Ritor1
parents:
diff changeset
2181 void *v27; // ecx@76
Ritor1
parents:
diff changeset
2182 char v46[140]; // [sp+Ch] [bp-94h]@13
Ritor1
parents:
diff changeset
2183 unsigned int v47; // [sp+98h] [bp-8h]@1
Ritor1
parents:
diff changeset
2184 ItemGen* v48; // [sp+9Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
2185
Ritor1
parents:
diff changeset
2186 v4 = 0;
Ritor1
parents:
diff changeset
2187 v47 = 0;
Ritor1
parents:
diff changeset
2188 v48 = nullptr;
Ritor1
parents:
diff changeset
2189 switch ( attTypeCast )
Ritor1
parents:
diff changeset
2190 {
Ritor1
parents:
diff changeset
2191 case SPECIAL_ATTACK_CURSE:
Ritor1
parents:
diff changeset
2192 v6 = GetActualWillpower();
Ritor1
parents:
diff changeset
2193 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2194 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2195
2498
Ritor1
parents:
diff changeset
2196 case SPECIAL_ATTACK_WEAK:
Ritor1
parents:
diff changeset
2197 case SPECIAL_ATTACK_SLEEP:
Ritor1
parents:
diff changeset
2198 case SPECIAL_ATTACK_DRUNK:
Ritor1
parents:
diff changeset
2199 case SPECIAL_ATTACK_DISEASE_WEAK:
Ritor1
parents:
diff changeset
2200 case SPECIAL_ATTACK_DISEASE_MEDIUM:
Ritor1
parents:
diff changeset
2201 case SPECIAL_ATTACK_DISEASE_SEVERE:
Ritor1
parents:
diff changeset
2202 case SPECIAL_ATTACK_UNCONSCIOUS:
Ritor1
parents:
diff changeset
2203 case SPECIAL_ATTACK_AGING:
Ritor1
parents:
diff changeset
2204 v6 = GetActualEndurance();
Ritor1
parents:
diff changeset
2205 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2206 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2207
2498
Ritor1
parents:
diff changeset
2208 case SPECIAL_ATTACK_INSANE:
Ritor1
parents:
diff changeset
2209 case SPECIAL_ATTACK_PARALYZED:
Ritor1
parents:
diff changeset
2210 case SPECIAL_ATTACK_FEAR:
Ritor1
parents:
diff changeset
2211 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
Ritor1
parents:
diff changeset
2212 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2213
2498
Ritor1
parents:
diff changeset
2214 case SPECIAL_ATTACK_PETRIFIED:
Ritor1
parents:
diff changeset
2215 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
Ritor1
parents:
diff changeset
2216 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2217
2498
Ritor1
parents:
diff changeset
2218 case SPECIAL_ATTACK_POISON_WEAK:
Ritor1
parents:
diff changeset
2219 case SPECIAL_ATTACK_POISON_MEDIUM:
Ritor1
parents:
diff changeset
2220 case SPECIAL_ATTACK_POISON_SEVERE:
Ritor1
parents:
diff changeset
2221 case SPECIAL_ATTACK_DEAD:
Ritor1
parents:
diff changeset
2222 case SPECIAL_ATTACK_ERADICATED:
Ritor1
parents:
diff changeset
2223 v11 = GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
Ritor1
parents:
diff changeset
2224 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2225
2498
Ritor1
parents:
diff changeset
2226 case SPECIAL_ATTACK_MANA_DRAIN:
Ritor1
parents:
diff changeset
2227 v8 = GetActualWillpower();
Ritor1
parents:
diff changeset
2228 v10 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2229 v11 = (GetParameterBonus(v10) + GetParameterBonus(v8)) / 2;
Ritor1
parents:
diff changeset
2230 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2231
2498
Ritor1
parents:
diff changeset
2232 case SPECIAL_ATTACK_BREAK_ANY:
Ritor1
parents:
diff changeset
2233 for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
2234 {
Ritor1
parents:
diff changeset
2235 v13 = &this->pInventoryItemList[i];
Ritor1
parents:
diff changeset
2236 if ( v13->uItemID > 0 && v13->uItemID <= 134 && !v13->IsBroken())
Ritor1
parents:
diff changeset
2237 v46[v4++] = i;
Ritor1
parents:
diff changeset
2238 }
Ritor1
parents:
diff changeset
2239 if ( !v4 )
Ritor1
parents:
diff changeset
2240 return 0;
Ritor1
parents:
diff changeset
2241 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2242 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2243 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2244
2498
Ritor1
parents:
diff changeset
2245 case SPECIAL_ATTACK_BREAK_ARMOR:
Ritor1
parents:
diff changeset
2246 for (int i = 0; i < 16; i++ )
Ritor1
parents:
diff changeset
2247 {
Ritor1
parents:
diff changeset
2248 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2249 {
Ritor1
parents:
diff changeset
2250 if ( i == EQUIP_ARMOUR )
Ritor1
parents:
diff changeset
2251 v46[v4++] = this->pEquipment.uArmor - 1;
Ritor1
parents:
diff changeset
2252 if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD )
Ritor1
parents:
diff changeset
2253 v46[v4++] = this->pEquipment.pIndices[i] - 1;
Ritor1
parents:
diff changeset
2254 }
Ritor1
parents:
diff changeset
2255 }
Ritor1
parents:
diff changeset
2256 if ( !v4 )
Ritor1
parents:
diff changeset
2257 return 0;
Ritor1
parents:
diff changeset
2258 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2259 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2260 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2261
2498
Ritor1
parents:
diff changeset
2262 case SPECIAL_ATTACK_BREAK_WEAPON:
Ritor1
parents:
diff changeset
2263 for (int i = 0; i < 16; i++ )
Ritor1
parents:
diff changeset
2264 {
Ritor1
parents:
diff changeset
2265 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2266 {
Ritor1
parents:
diff changeset
2267 if ( i == EQUIP_BOW )
Ritor1
parents:
diff changeset
2268 v46[v4++] = LOBYTE(this->pEquipment.uBow) - 1;
Ritor1
parents:
diff changeset
2269 if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED)
Ritor1
parents:
diff changeset
2270 && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SINGLE_HANDED || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
2271 v46[v4++] = this->pEquipment.pIndices[i] - 1;
Ritor1
parents:
diff changeset
2272 }
Ritor1
parents:
diff changeset
2273 }
Ritor1
parents:
diff changeset
2274 if ( !v4 )
Ritor1
parents:
diff changeset
2275 return 0;
Ritor1
parents:
diff changeset
2276 v48 = &this->pInventoryItemList[v46[rand() % v4]];
Ritor1
parents:
diff changeset
2277 v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod());
Ritor1
parents:
diff changeset
2278 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2279
2498
Ritor1
parents:
diff changeset
2280 case SPECIAL_ATTACK_STEAL:
Ritor1
parents:
diff changeset
2281 for ( int i = 0; i < 126; i++ )
Ritor1
parents:
diff changeset
2282 {
Ritor1
parents:
diff changeset
2283 int ItemPosInList = this->pInventoryMatrix[i];
Ritor1
parents:
diff changeset
2284 if (ItemPosInList > 0)
Ritor1
parents:
diff changeset
2285 {
Ritor1
parents:
diff changeset
2286 ItemGen* v21 = &this->pInventoryItemList[ItemPosInList - 1];
Ritor1
parents:
diff changeset
2287 if ( v21->uItemID > 0 && v21->uItemID <= 134 )
Ritor1
parents:
diff changeset
2288 {
Ritor1
parents:
diff changeset
2289 v46[v4++] = i;
Ritor1
parents:
diff changeset
2290 }
Ritor1
parents:
diff changeset
2291 }
Ritor1
parents:
diff changeset
2292 }
Ritor1
parents:
diff changeset
2293 if ( !v4 )
Ritor1
parents:
diff changeset
2294 return 0;
Ritor1
parents:
diff changeset
2295 v47 = v46[rand() % v4];
Ritor1
parents:
diff changeset
2296 v6 = GetActualAccuracy();
Ritor1
parents:
diff changeset
2297 v11 = GetParameterBonus(v6);
Ritor1
parents:
diff changeset
2298 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2299
2498
Ritor1
parents:
diff changeset
2300 default:
Ritor1
parents:
diff changeset
2301 v11 = 0;
Ritor1
parents:
diff changeset
2302 break;
Ritor1
parents:
diff changeset
2303 }
Ritor1
parents:
diff changeset
2304 v22 = GetActualLuck();
Ritor1
parents:
diff changeset
2305 v23 = GetParameterBonus(v22) + v11 + 30;
Ritor1
parents:
diff changeset
2306 if ( rand() % v23 >= 30 )
Ritor1
parents:
diff changeset
2307 {
Ritor1
parents:
diff changeset
2308 return 0;
Ritor1
parents:
diff changeset
2309 }
Ritor1
parents:
diff changeset
2310 else
Ritor1
parents:
diff changeset
2311 {
Ritor1
parents:
diff changeset
2312 for ( v3 = 0; v3 < 4; v3++ )
Ritor1
parents:
diff changeset
2313 {
Ritor1
parents:
diff changeset
2314 if ( this == pPlayers[v3 + 1] )
Ritor1
parents:
diff changeset
2315 break;
Ritor1
parents:
diff changeset
2316 }
Ritor1
parents:
diff changeset
2317
Ritor1
parents:
diff changeset
2318 switch ( attTypeCast )
Ritor1
parents:
diff changeset
2319 {
Ritor1
parents:
diff changeset
2320 case SPECIAL_ATTACK_CURSE:
Ritor1
parents:
diff changeset
2321 SetCondition(Condition_Cursed, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2322 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2323 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2324 return 1;
Ritor1
parents:
diff changeset
2325 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2326
2498
Ritor1
parents:
diff changeset
2327 case SPECIAL_ATTACK_WEAK:
Ritor1
parents:
diff changeset
2328 SetCondition(Condition_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2329 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2330 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2331 return 1;
Ritor1
parents:
diff changeset
2332 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2333
2498
Ritor1
parents:
diff changeset
2334 case SPECIAL_ATTACK_SLEEP:
Ritor1
parents:
diff changeset
2335 SetCondition(Condition_Sleep, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2336 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2337 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2338 return 1;
Ritor1
parents:
diff changeset
2339 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2340
2498
Ritor1
parents:
diff changeset
2341 case SPECIAL_ATTACK_DRUNK:
Ritor1
parents:
diff changeset
2342 SetCondition(Condition_Drunk, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2343 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2344 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2345 return 1;
Ritor1
parents:
diff changeset
2346 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2347
2498
Ritor1
parents:
diff changeset
2348 case SPECIAL_ATTACK_INSANE:
Ritor1
parents:
diff changeset
2349 SetCondition(Condition_Insane, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2350 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2351 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2352 return 1;
Ritor1
parents:
diff changeset
2353 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2354
2498
Ritor1
parents:
diff changeset
2355 case SPECIAL_ATTACK_POISON_WEAK:
Ritor1
parents:
diff changeset
2356 SetCondition(Condition_Poison_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2357 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2358 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2359 return 1;
Ritor1
parents:
diff changeset
2360 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2361
2498
Ritor1
parents:
diff changeset
2362 case SPECIAL_ATTACK_POISON_MEDIUM:
Ritor1
parents:
diff changeset
2363 SetCondition(Condition_Poison_Medium, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2364 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2365 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2366 return 1;
Ritor1
parents:
diff changeset
2367 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2368
2498
Ritor1
parents:
diff changeset
2369 case SPECIAL_ATTACK_POISON_SEVERE:
Ritor1
parents:
diff changeset
2370 SetCondition(Condition_Poison_Severe, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2371 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2372 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2373 return 1;
Ritor1
parents:
diff changeset
2374 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2375
2498
Ritor1
parents:
diff changeset
2376 case SPECIAL_ATTACK_DISEASE_WEAK:
Ritor1
parents:
diff changeset
2377 SetCondition(Condition_Disease_Weak, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2378 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2379 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2380 return 1;
Ritor1
parents:
diff changeset
2381 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2382
2498
Ritor1
parents:
diff changeset
2383 case SPECIAL_ATTACK_DISEASE_MEDIUM:
Ritor1
parents:
diff changeset
2384 SetCondition(Condition_Disease_Medium, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2385 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2386 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2387 return 1;
Ritor1
parents:
diff changeset
2388 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2389
2498
Ritor1
parents:
diff changeset
2390 case SPECIAL_ATTACK_DISEASE_SEVERE:
Ritor1
parents:
diff changeset
2391 SetCondition(Condition_Disease_Severe, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2392 pAudioPlayer->PlaySound(SOUND_star2, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2393 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99, v3);
2498
Ritor1
parents:
diff changeset
2394 return 1;
Ritor1
parents:
diff changeset
2395 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2396
2498
Ritor1
parents:
diff changeset
2397 case SPECIAL_ATTACK_PARALYZED:
Ritor1
parents:
diff changeset
2398 SetCondition(Condition_Paralyzed, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2399 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2400 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2401 return 1;
Ritor1
parents:
diff changeset
2402 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2403
2498
Ritor1
parents:
diff changeset
2404 case SPECIAL_ATTACK_UNCONSCIOUS:
Ritor1
parents:
diff changeset
2405 SetCondition(Condition_Unconcious, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2406 pAudioPlayer->PlaySound(SOUND_star4, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2407 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2408 return 1;
Ritor1
parents:
diff changeset
2409 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2410
2498
Ritor1
parents:
diff changeset
2411 case SPECIAL_ATTACK_DEAD:
Ritor1
parents:
diff changeset
2412 SetCondition(Condition_Dead, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2413 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2414 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2415 return 1;
Ritor1
parents:
diff changeset
2416 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2417
2498
Ritor1
parents:
diff changeset
2418 case SPECIAL_ATTACK_PETRIFIED:
Ritor1
parents:
diff changeset
2419 SetCondition(Condition_Pertified, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2420 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2421 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2422 return 1;
Ritor1
parents:
diff changeset
2423 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2424
2498
Ritor1
parents:
diff changeset
2425 case SPECIAL_ATTACK_ERADICATED:
Ritor1
parents:
diff changeset
2426 SetCondition(Condition_Eradicated, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2427 pAudioPlayer->PlaySound(SOUND_eradicate, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2428 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2429 return 1;
Ritor1
parents:
diff changeset
2430 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2431
2498
Ritor1
parents:
diff changeset
2432 case SPECIAL_ATTACK_BREAK_ANY:
Ritor1
parents:
diff changeset
2433 case SPECIAL_ATTACK_BREAK_ARMOR:
Ritor1
parents:
diff changeset
2434 case SPECIAL_ATTACK_BREAK_WEAPON:
Ritor1
parents:
diff changeset
2435 if ( !(v48->uAttributes & ITEM_HARDENED) )
Ritor1
parents:
diff changeset
2436 {
Ritor1
parents:
diff changeset
2437 PlaySound(SPEECH_40, 0);
Ritor1
parents:
diff changeset
2438 v48->SetBroken();
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2439 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
2440 }
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2441 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2442 return 1;
Ritor1
parents:
diff changeset
2443 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2444
2498
Ritor1
parents:
diff changeset
2445 case SPECIAL_ATTACK_STEAL:
Ritor1
parents:
diff changeset
2446 PlaySound(SPEECH_40, 0);
Ritor1
parents:
diff changeset
2447 v27 = pActor->ActorHasItems;
Ritor1
parents:
diff changeset
2448 if ( pActor->ActorHasItems[0].uItemID )
Ritor1
parents:
diff changeset
2449 {
Ritor1
parents:
diff changeset
2450 v27 = &pActor->ActorHasItems[1];
Ritor1
parents:
diff changeset
2451 if ( pActor->ActorHasItems[1].uItemID )
Ritor1
parents:
diff changeset
2452 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2453 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2454 return 1;
Ritor1
parents:
diff changeset
2455 }
Ritor1
parents:
diff changeset
2456 }
Ritor1
parents:
diff changeset
2457 memcpy(v27, &this->pInventoryItemList[this->pInventoryMatrix[v47]-1], 0x24u);
Ritor1
parents:
diff changeset
2458 RemoveItemAtInventoryIndex(v47);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2459 pAudioPlayer->PlaySound(SOUND_metal_vs_metal03h, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2460 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2461 return 1;
Ritor1
parents:
diff changeset
2462 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2463
2498
Ritor1
parents:
diff changeset
2464 case SPECIAL_ATTACK_AGING:
Ritor1
parents:
diff changeset
2465 PlaySound(SPEECH_42, 0);
Ritor1
parents:
diff changeset
2466 ++this->sAgeModifier;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2467 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2468 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2469 return 1;
Ritor1
parents:
diff changeset
2470 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2471
2498
Ritor1
parents:
diff changeset
2472 case SPECIAL_ATTACK_MANA_DRAIN:
Ritor1
parents:
diff changeset
2473 PlaySound(SPEECH_41, 0);
Ritor1
parents:
diff changeset
2474 this->sMana = 0;
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2475 pAudioPlayer->PlaySound(SOUND_eleccircle, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2476 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2477 return 1;
Ritor1
parents:
diff changeset
2478 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2479
2498
Ritor1
parents:
diff changeset
2480 case SPECIAL_ATTACK_FEAR:
Ritor1
parents:
diff changeset
2481 SetCondition(Condition_Fear, 1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
2482 pAudioPlayer->PlaySound(SOUND_star1, 0, 0, -1, 0, 0, 0, 0);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
2483 pEngine->pStru6Instance->SetPlayerBuffAnim(0x99u, v3);
2498
Ritor1
parents:
diff changeset
2484 return 1;
Ritor1
parents:
diff changeset
2485 break;
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2486
2498
Ritor1
parents:
diff changeset
2487 default:
Ritor1
parents:
diff changeset
2488 return 0;
Ritor1
parents:
diff changeset
2489 }
Ritor1
parents:
diff changeset
2490 }
Ritor1
parents:
diff changeset
2491 }
Ritor1
parents:
diff changeset
2492
Ritor1
parents:
diff changeset
2493 // 48DCF6: using guessed type char var_94[140];
Ritor1
parents:
diff changeset
2494
Ritor1
parents:
diff changeset
2495 //----- (0048E1A3) --------------------------------------------------------
Ritor1
parents:
diff changeset
2496 unsigned int Player::GetSpellSchool(unsigned int uSpellID)
Ritor1
parents:
diff changeset
2497 {
Ritor1
parents:
diff changeset
2498 return pSpellStats->pInfos[uSpellID].uSchool;
Ritor1
parents:
diff changeset
2499 }
Ritor1
parents:
diff changeset
2500
Ritor1
parents:
diff changeset
2501 //----- (0048E1B5) --------------------------------------------------------
Ritor1
parents:
diff changeset
2502 int Player::GetAttackRecoveryTime(bool bRangedAttack)
Ritor1
parents:
diff changeset
2503 {
Ritor1
parents:
diff changeset
2504 ItemGen *weapon = nullptr;
Ritor1
parents:
diff changeset
2505 uint weapon_recovery = base_recovery_times_per_weapon_type[0];
Ritor1
parents:
diff changeset
2506 if (bRangedAttack)
Ritor1
parents:
diff changeset
2507 {
Ritor1
parents:
diff changeset
2508 if ( HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
2509 {
Ritor1
parents:
diff changeset
2510 weapon = GetBowItem();
Ritor1
parents:
diff changeset
2511 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2512 }
Ritor1
parents:
diff changeset
2513 }
Ritor1
parents:
diff changeset
2514 else if ( IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
2515 {
Ritor1
parents:
diff changeset
2516 weapon_recovery = base_recovery_times_per_weapon_type[1];
Ritor1
parents:
diff changeset
2517 }
Ritor1
parents:
diff changeset
2518 else if ( HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
2519 {
Ritor1
parents:
diff changeset
2520 weapon = GetMainHandItem();
Ritor1
parents:
diff changeset
2521 if (weapon->GetItemEquipType() == EQUIP_WAND)
Ritor1
parents:
diff changeset
2522 {
Ritor1
parents:
diff changeset
2523 __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
Ritor1
parents:
diff changeset
2524 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now
Ritor1
parents:
diff changeset
2525 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery;
Ritor1
parents:
diff changeset
2526 }
Ritor1
parents:
diff changeset
2527 else
Ritor1
parents:
diff changeset
2528 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2529 }
Ritor1
parents:
diff changeset
2530 if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) != EQUIP_SHIELD)
Ritor1
parents:
diff changeset
2531 // ADD: shield check because shield recovery is added later and can be accidentally doubled
Ritor1
parents:
diff changeset
2532 {
Ritor1
parents:
diff changeset
2533 if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery)
Ritor1
parents:
diff changeset
2534 {
Ritor1
parents:
diff changeset
2535 weapon = GetOffHandItem();
Ritor1
parents:
diff changeset
2536 weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()];
Ritor1
parents:
diff changeset
2537 }
Ritor1
parents:
diff changeset
2538 }
Ritor1
parents:
diff changeset
2539
Ritor1
parents:
diff changeset
2540 uint armour_recovery = 0;
Ritor1
parents:
diff changeset
2541 if ( HasItemEquipped(EQUIP_ARMOUR) )
Ritor1
parents:
diff changeset
2542 {
Ritor1
parents:
diff changeset
2543 uchar armour_skill_type = GetArmorItem()->GetPlayerSkillType();
Ritor1
parents:
diff changeset
2544 uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type];
Ritor1
parents:
diff changeset
2545 float multiplier;
Ritor1
parents:
diff changeset
2546
Ritor1
parents:
diff changeset
2547 if (armour_skill_type == PLAYER_SKILL_LEATHER)
Ritor1
parents:
diff changeset
2548 {
Ritor1
parents:
diff changeset
2549 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0, 0, 0);
Ritor1
parents:
diff changeset
2550 }
Ritor1
parents:
diff changeset
2551 else if (armour_skill_type == PLAYER_SKILL_CHAIN)
Ritor1
parents:
diff changeset
2552 {
Ritor1
parents:
diff changeset
2553 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0, 0);
Ritor1
parents:
diff changeset
2554 }
Ritor1
parents:
diff changeset
2555 else if (armour_skill_type == PLAYER_SKILL_PLATE)
Ritor1
parents:
diff changeset
2556 {
Ritor1
parents:
diff changeset
2557 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 0.5f, 0.5f, 0);
Ritor1
parents:
diff changeset
2558 }
Ritor1
parents:
diff changeset
2559 else
Ritor1
parents:
diff changeset
2560 {
Ritor1
parents:
diff changeset
2561 Error("Unknown armour type"); // what kind of armour is that?
Ritor1
parents:
diff changeset
2562 multiplier = GetArmorRecoveryMultiplierFromSkillLevel(armour_skill_type, 1.0f, 1.0f, 1.0f, 1.0f);
Ritor1
parents:
diff changeset
2563 }
Ritor1
parents:
diff changeset
2564
Ritor1
parents:
diff changeset
2565 armour_recovery = (uint)(base_armour_recovery * multiplier);
Ritor1
parents:
diff changeset
2566 }
Ritor1
parents:
diff changeset
2567
Ritor1
parents:
diff changeset
2568 uint shield_recovery = 0;
Ritor1
parents:
diff changeset
2569 if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) == EQUIP_SHIELD)
Ritor1
parents:
diff changeset
2570 {
Ritor1
parents:
diff changeset
2571 uchar skill_type = GetOffHandItem()->GetPlayerSkillType();
Ritor1
parents:
diff changeset
2572
Ritor1
parents:
diff changeset
2573 uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type];
Ritor1
parents:
diff changeset
2574 float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0);
Ritor1
parents:
diff changeset
2575 shield_recovery = (uint)(shield_base_recovery * multiplier);
Ritor1
parents:
diff changeset
2576 }
Ritor1
parents:
diff changeset
2577
Ritor1
parents:
diff changeset
2578 uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()),
Ritor1
parents:
diff changeset
2579 sword_axe_bow_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2580 bool shooting_laser = false;
Ritor1
parents:
diff changeset
2581 if (weapon != nullptr)
Ritor1
parents:
diff changeset
2582 {
Ritor1
parents:
diff changeset
2583 if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) &&
Ritor1
parents:
diff changeset
2584 (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD || weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE || weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW) )
Ritor1
parents:
diff changeset
2585 {
Ritor1
parents:
diff changeset
2586 if (SkillToMastery(pActiveSkills[weapon->GetPlayerSkillType()]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery
Ritor1
parents:
diff changeset
2587 sword_axe_bow_recovery_reduction = pActiveSkills[weapon->GetPlayerSkillType()] & 0x3F;
Ritor1
parents:
diff changeset
2588 }
Ritor1
parents:
diff changeset
2589 if (weapon->GetPlayerSkillType() == PLAYER_SKILL_BLASTER)
Ritor1
parents:
diff changeset
2590 shooting_laser = true;
Ritor1
parents:
diff changeset
2591 }
Ritor1
parents:
diff changeset
2592
Ritor1
parents:
diff changeset
2593 uint armsmaster_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2594 if (!bRangedAttack && !shooting_laser)
Ritor1
parents:
diff changeset
2595 {
Ritor1
parents:
diff changeset
2596 if (uint armsmaster_level = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER))
Ritor1
parents:
diff changeset
2597 {
Ritor1
parents:
diff changeset
2598 armsmaster_recovery_reduction = armsmaster_level & 0x3F;
Ritor1
parents:
diff changeset
2599 if (SkillToMastery(armsmaster_level) >= 4)
Ritor1
parents:
diff changeset
2600 armsmaster_recovery_reduction *= 2;
Ritor1
parents:
diff changeset
2601 }
Ritor1
parents:
diff changeset
2602 }
Ritor1
parents:
diff changeset
2603
Ritor1
parents:
diff changeset
2604 uint hasteRecoveryReduction = 0;
Ritor1
parents:
diff changeset
2605 if (pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0 || pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0 )
Ritor1
parents:
diff changeset
2606 hasteRecoveryReduction = 25;
Ritor1
parents:
diff changeset
2607
Ritor1
parents:
diff changeset
2608 uint weapon_enchantment_recovery_reduction = 0;
Ritor1
parents:
diff changeset
2609 if ( weapon )
Ritor1
parents:
diff changeset
2610 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2611 if (weapon->special_enchantment == 59 ||
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2612 weapon->special_enchantment == 41 ||
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2613 weapon->special_enchantment == 500)
2498
Ritor1
parents:
diff changeset
2614 weapon_enchantment_recovery_reduction = 20;
Ritor1
parents:
diff changeset
2615 }
Ritor1
parents:
diff changeset
2616
Ritor1
parents:
diff changeset
2617 int recovery = weapon_recovery +
Ritor1
parents:
diff changeset
2618 armour_recovery +
Ritor1
parents:
diff changeset
2619 shield_recovery
Ritor1
parents:
diff changeset
2620 - armsmaster_recovery_reduction
Ritor1
parents:
diff changeset
2621 - weapon_enchantment_recovery_reduction
Ritor1
parents:
diff changeset
2622 - hasteRecoveryReduction
Ritor1
parents:
diff changeset
2623 - sword_axe_bow_recovery_reduction
Ritor1
parents:
diff changeset
2624 - player_speed_recovery_reduction;
Ritor1
parents:
diff changeset
2625
Ritor1
parents:
diff changeset
2626 if (recovery < 0)
Ritor1
parents:
diff changeset
2627 recovery = 0;
Ritor1
parents:
diff changeset
2628 return recovery;
Ritor1
parents:
diff changeset
2629 }
Ritor1
parents:
diff changeset
2630
Ritor1
parents:
diff changeset
2631
Ritor1
parents:
diff changeset
2632 //----- new --------------------------------------------------------
Ritor1
parents:
diff changeset
2633 float Player::GetArmorRecoveryMultiplierFromSkillLevel( unsigned char armour_skill_type, float mult1, float mult2, float mult3, float mult4 )
Ritor1
parents:
diff changeset
2634 {
Ritor1
parents:
diff changeset
2635 uint skill_mastery = SkillToMastery(pActiveSkills[armour_skill_type]);
Ritor1
parents:
diff changeset
2636 switch (skill_mastery)
Ritor1
parents:
diff changeset
2637 {
Ritor1
parents:
diff changeset
2638 case 1: return mult1; break;
Ritor1
parents:
diff changeset
2639 case 2: return mult2; break;
Ritor1
parents:
diff changeset
2640 case 3: return mult3; break;
Ritor1
parents:
diff changeset
2641 case 4: return mult4; break;
Ritor1
parents:
diff changeset
2642 }
Ritor1
parents:
diff changeset
2643 Error("Unexpected input value: %d", armour_skill_type);
Ritor1
parents:
diff changeset
2644 return 0;
Ritor1
parents:
diff changeset
2645 }
Ritor1
parents:
diff changeset
2646
Ritor1
parents:
diff changeset
2647 //----- (0048E4F8) --------------------------------------------------------
Ritor1
parents:
diff changeset
2648 int Player::GetMaxHealth()
Ritor1
parents:
diff changeset
2649 {
Ritor1
parents:
diff changeset
2650 int v3; // esi@1
Ritor1
parents:
diff changeset
2651 int v4; // esi@1
Ritor1
parents:
diff changeset
2652 int v6; // esi@1
Ritor1
parents:
diff changeset
2653
Ritor1
parents:
diff changeset
2654 v3 = GetParameterBonus(GetActualEndurance());
Ritor1
parents:
diff changeset
2655 v4 = pBaseHealthPerLevelByClass[classType] * (GetActualLevel() + v3);
Ritor1
parents:
diff changeset
2656 v6 = uFullHealthBonus
Ritor1
parents:
diff changeset
2657 + pBaseHealthByClass[classType / 4]
Ritor1
parents:
diff changeset
2658 + GetSkillBonus(CHARACTER_ATTRIBUTE_HEALTH)
Ritor1
parents:
diff changeset
2659 + GetItemsBonus(CHARACTER_ATTRIBUTE_HEALTH) + v4;
Ritor1
parents:
diff changeset
2660 return max(1, v6);
Ritor1
parents:
diff changeset
2661 }
Ritor1
parents:
diff changeset
2662
Ritor1
parents:
diff changeset
2663 //----- (0048E565) --------------------------------------------------------
Ritor1
parents:
diff changeset
2664 int Player::GetMaxMana()
Ritor1
parents:
diff changeset
2665 {
Ritor1
parents:
diff changeset
2666 int v2; // eax@2
Ritor1
parents:
diff changeset
2667 int v3; // esi@4
Ritor1
parents:
diff changeset
2668 int v4; // eax@5
Ritor1
parents:
diff changeset
2669 int v5; // esi@5
Ritor1
parents:
diff changeset
2670 int v6; // eax@5
Ritor1
parents:
diff changeset
2671 int v7; // esi@6
Ritor1
parents:
diff changeset
2672 int v8; // esi@6
Ritor1
parents:
diff changeset
2673 int v9; // esi@6
Ritor1
parents:
diff changeset
2674
Ritor1
parents:
diff changeset
2675 switch (classType)
Ritor1
parents:
diff changeset
2676 {
Ritor1
parents:
diff changeset
2677 case PLAYER_CLASS_ROGUE:
Ritor1
parents:
diff changeset
2678 case PLAYER_CLASS_SPY:
Ritor1
parents:
diff changeset
2679 case PLAYER_CLASS_ASSASSIN:
Ritor1
parents:
diff changeset
2680 case PLAYER_CLASS_ARCHER:
Ritor1
parents:
diff changeset
2681 case PLAYER_CLASS_WARRIOR_MAGE:
Ritor1
parents:
diff changeset
2682 case PLAYER_CLASS_MASTER_ARCHER:
Ritor1
parents:
diff changeset
2683 case PLAYER_CLASS_SNIPER:
Ritor1
parents:
diff changeset
2684 case PLAYER_CLASS_SORCERER:
Ritor1
parents:
diff changeset
2685 case PLAYER_CLASS_WIZARD:
Ritor1
parents:
diff changeset
2686 case PLAYER_CLASS_ARCHMAGE:
Ritor1
parents:
diff changeset
2687 case PLAYER_CLASS_LICH:
Ritor1
parents:
diff changeset
2688 v2 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2689 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2690 break;
Ritor1
parents:
diff changeset
2691 case PLAYER_CLASS_INITIATE:
Ritor1
parents:
diff changeset
2692 case PLAYER_CLASS_MASTER:
Ritor1
parents:
diff changeset
2693 case PLAYER_CLASS_NINJA:
Ritor1
parents:
diff changeset
2694 case PLAYER_CLASS_PALADIN:
Ritor1
parents:
diff changeset
2695 case PLAYER_CLASS_CRUSADER:
Ritor1
parents:
diff changeset
2696 case PLAYER_CLASS_HERO:
Ritor1
parents:
diff changeset
2697 case PLAYER_CLASS_VILLIAN:
Ritor1
parents:
diff changeset
2698 case PLAYER_CLASS_CLERIC:
Ritor1
parents:
diff changeset
2699 case PLAYER_CLASS_PRIEST:
Ritor1
parents:
diff changeset
2700 case PLAYER_CLASS_PRIEST_OF_SUN:
Ritor1
parents:
diff changeset
2701 case PLAYER_CLASS_PRIEST_OF_MOON:
Ritor1
parents:
diff changeset
2702 v2 = GetActualWillpower();
Ritor1
parents:
diff changeset
2703 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2704 break;
Ritor1
parents:
diff changeset
2705 case PLAYER_CLASS_HUNTER:
Ritor1
parents:
diff changeset
2706 case PLAYER_CLASS_RANGER_LORD:
Ritor1
parents:
diff changeset
2707 case PLAYER_CLASS_BOUNTY_HUNTER:
Ritor1
parents:
diff changeset
2708 case PLAYER_CLASS_DRUID:
Ritor1
parents:
diff changeset
2709 case PLAYER_CLASS_GREAT_DRUID:
Ritor1
parents:
diff changeset
2710 case PLAYER_CLASS_ARCH_DRUID:
Ritor1
parents:
diff changeset
2711 case PLAYER_CLASS_WARLOCK:
Ritor1
parents:
diff changeset
2712 v4 = GetActualWillpower();
Ritor1
parents:
diff changeset
2713 v5 = GetParameterBonus(v4);
Ritor1
parents:
diff changeset
2714 v6 = GetActualIntelligence();
Ritor1
parents:
diff changeset
2715 v3 = GetParameterBonus(v6) + v5;
Ritor1
parents:
diff changeset
2716 break;
Ritor1
parents:
diff changeset
2717 default:
Ritor1
parents:
diff changeset
2718 return 0;
Ritor1
parents:
diff changeset
2719 break;
Ritor1
parents:
diff changeset
2720 }
Ritor1
parents:
diff changeset
2721 v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
Ritor1
parents:
diff changeset
2722 v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA) + v7;
Ritor1
parents:
diff changeset
2723 v9 = uFullManaBonus
Ritor1
parents:
diff changeset
2724 + pBaseManaByClass[classType / 4]
Ritor1
parents:
diff changeset
2725 + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA)
Ritor1
parents:
diff changeset
2726 + v8;
Ritor1
parents:
diff changeset
2727 return max(0,v9);
Ritor1
parents:
diff changeset
2728 }
Ritor1
parents:
diff changeset
2729
Ritor1
parents:
diff changeset
2730 //----- (0048E656) --------------------------------------------------------
Ritor1
parents:
diff changeset
2731 int Player::GetBaseAC()
Ritor1
parents:
diff changeset
2732 {
Ritor1
parents:
diff changeset
2733 int v2; // eax@1
Ritor1
parents:
diff changeset
2734 int v3; // esi@1
Ritor1
parents:
diff changeset
2735 int v4; // esi@1
Ritor1
parents:
diff changeset
2736 int v5; // esi@1
Ritor1
parents:
diff changeset
2737
Ritor1
parents:
diff changeset
2738 v2 = GetActualSpeed();
Ritor1
parents:
diff changeset
2739 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2740 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
Ritor1
parents:
diff changeset
2741 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
Ritor1
parents:
diff changeset
2742 return max(0, v5);
Ritor1
parents:
diff changeset
2743 }
Ritor1
parents:
diff changeset
2744
Ritor1
parents:
diff changeset
2745 //----- (0048E68F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2746 int Player::GetActualAC()
Ritor1
parents:
diff changeset
2747 {
Ritor1
parents:
diff changeset
2748 int v2; // eax@1
Ritor1
parents:
diff changeset
2749 int v3; // esi@1
Ritor1
parents:
diff changeset
2750 int v4; // esi@1
Ritor1
parents:
diff changeset
2751 int v5; // esi@1
Ritor1
parents:
diff changeset
2752 int v6; // esi@1
Ritor1
parents:
diff changeset
2753
Ritor1
parents:
diff changeset
2754 v2 = GetActualSpeed();
Ritor1
parents:
diff changeset
2755 v3 = GetParameterBonus(v2);
Ritor1
parents:
diff changeset
2756 v4 = GetItemsBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v3;
Ritor1
parents:
diff changeset
2757 v5 = GetSkillBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v4;
Ritor1
parents:
diff changeset
2758 v6 = this->sACModifier + GetMagicalBonus(CHARACTER_ATTRIBUTE_AC_BONUS) + v5;
Ritor1
parents:
diff changeset
2759 return max(0, v6);
Ritor1
parents:
diff changeset
2760 }
Ritor1
parents:
diff changeset
2761
Ritor1
parents:
diff changeset
2762 //----- (0048E6DC) --------------------------------------------------------
Ritor1
parents:
diff changeset
2763 unsigned int Player::GetBaseAge()
Ritor1
parents:
diff changeset
2764 {
Ritor1
parents:
diff changeset
2765 return (unsigned int)(((__int64)(pParty->uTimePlayed * 0.234375) / 60 / 60 / 24) / 7 / 4 / 12 - uBirthYear + game_starting_year);
Ritor1
parents:
diff changeset
2766 }
Ritor1
parents:
diff changeset
2767
Ritor1
parents:
diff changeset
2768 //----- (0048E72C) --------------------------------------------------------
Ritor1
parents:
diff changeset
2769 unsigned int Player::GetActualAge()
Ritor1
parents:
diff changeset
2770 {
Ritor1
parents:
diff changeset
2771 return this->sAgeModifier + GetBaseAge();
Ritor1
parents:
diff changeset
2772 }
Ritor1
parents:
diff changeset
2773
Ritor1
parents:
diff changeset
2774 //----- (0048E73F) --------------------------------------------------------
Ritor1
parents:
diff changeset
2775 int Player::GetBaseResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
2776 {
Ritor1
parents:
diff changeset
2777 int v7; // esi@20
Ritor1
parents:
diff changeset
2778 int racialBonus = 0;
Ritor1
parents:
diff changeset
2779 __int16* resStat;
Ritor1
parents:
diff changeset
2780 int result;
Ritor1
parents:
diff changeset
2781
Ritor1
parents:
diff changeset
2782 switch (a2)
Ritor1
parents:
diff changeset
2783 {
Ritor1
parents:
diff changeset
2784 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
2785 resStat = &sResFireBase;
Ritor1
parents:
diff changeset
2786 if (IsRaceGoblin())
Ritor1
parents:
diff changeset
2787 racialBonus = 5;
Ritor1
parents:
diff changeset
2788 break;
Ritor1
parents:
diff changeset
2789 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
2790 resStat = &sResAirBase;
Ritor1
parents:
diff changeset
2791 if (IsRaceGoblin())
Ritor1
parents:
diff changeset
2792 racialBonus = 5;
Ritor1
parents:
diff changeset
2793 break;
Ritor1
parents:
diff changeset
2794 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
2795 resStat = &sResWaterBase;
Ritor1
parents:
diff changeset
2796 if (IsRaceDwarf())
Ritor1
parents:
diff changeset
2797 racialBonus = 5;
Ritor1
parents:
diff changeset
2798 break;
Ritor1
parents:
diff changeset
2799 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
2800 resStat = &sResEarthBase;
Ritor1
parents:
diff changeset
2801 if (IsRaceDwarf())
Ritor1
parents:
diff changeset
2802 racialBonus = 5;
Ritor1
parents:
diff changeset
2803 break;
Ritor1
parents:
diff changeset
2804 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
2805 resStat = &sResMindBase;
Ritor1
parents:
diff changeset
2806 if (IsRaceElf())
Ritor1
parents:
diff changeset
2807 racialBonus = 10;
Ritor1
parents:
diff changeset
2808 break;
Ritor1
parents:
diff changeset
2809 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
2810 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
2811 resStat = &sResBodyBase;
Ritor1
parents:
diff changeset
2812 if (IsRaceHuman())
Ritor1
parents:
diff changeset
2813 racialBonus = 5;
Ritor1
parents:
diff changeset
2814 break;
Ritor1
parents:
diff changeset
2815 default:
Ritor1
parents:
diff changeset
2816 Error("Unknown attribute");
Ritor1
parents:
diff changeset
2817 }
Ritor1
parents:
diff changeset
2818 v7 = GetItemsBonus(a2) + racialBonus;
Ritor1
parents:
diff changeset
2819 result = v7 + *resStat;
Ritor1
parents:
diff changeset
2820 if ( classType == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
2821 {
Ritor1
parents:
diff changeset
2822 if ( result > 200 )
Ritor1
parents:
diff changeset
2823 result = 200;
Ritor1
parents:
diff changeset
2824 }
Ritor1
parents:
diff changeset
2825 return result;
Ritor1
parents:
diff changeset
2826 }
Ritor1
parents:
diff changeset
2827
Ritor1
parents:
diff changeset
2828 //----- (0048E7D0) --------------------------------------------------------
Ritor1
parents:
diff changeset
2829 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
2830 {
Ritor1
parents:
diff changeset
2831 signed int v10 = 0; // [sp+14h] [bp-4h]@1
Ritor1
parents:
diff changeset
2832 __int16* resStat;
Ritor1
parents:
diff changeset
2833 int result;
Ritor1
parents:
diff changeset
2834 int baseRes;
Ritor1
parents:
diff changeset
2835
Ritor1
parents:
diff changeset
2836 int leatherArmorSkillLevel = GetActualSkillLevel(PLAYER_SKILL_LEATHER);
Ritor1
parents:
diff changeset
2837 if ( CheckHiredNPCSpeciality(Enchanter) )
Ritor1
parents:
diff changeset
2838 v10 = 20;
Ritor1
parents:
diff changeset
2839 if ( (a2 == CHARACTER_ATTRIBUTE_RESIST_FIRE
Ritor1
parents:
diff changeset
2840 || a2 == CHARACTER_ATTRIBUTE_RESIST_AIR
Ritor1
parents:
diff changeset
2841 || a2 == CHARACTER_ATTRIBUTE_RESIST_WATER
Ritor1
parents:
diff changeset
2842 || a2 == CHARACTER_ATTRIBUTE_RESIST_EARTH)
Ritor1
parents:
diff changeset
2843 && SkillToMastery(leatherArmorSkillLevel) == 4
Ritor1
parents:
diff changeset
2844 && HasItemEquipped(EQUIP_ARMOUR)
Ritor1
parents:
diff changeset
2845 && GetEquippedItemSkillType(EQUIP_ARMOUR) == PLAYER_SKILL_LEATHER )
Ritor1
parents:
diff changeset
2846 v10 += leatherArmorSkillLevel & 0x3F;
Ritor1
parents:
diff changeset
2847 switch (a2)
Ritor1
parents:
diff changeset
2848 {
Ritor1
parents:
diff changeset
2849 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
2850 resStat = &sResFireBonus;
Ritor1
parents:
diff changeset
2851 break;
Ritor1
parents:
diff changeset
2852 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
2853 resStat = &sResAirBonus;
Ritor1
parents:
diff changeset
2854 break;
Ritor1
parents:
diff changeset
2855 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
2856 resStat = &sResWaterBonus;
Ritor1
parents:
diff changeset
2857 break;
Ritor1
parents:
diff changeset
2858 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
2859 resStat = &sResEarthBonus;
Ritor1
parents:
diff changeset
2860 break;
Ritor1
parents:
diff changeset
2861 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
2862 resStat = &sResMindBonus;
Ritor1
parents:
diff changeset
2863 break;
Ritor1
parents:
diff changeset
2864 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
2865 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
2866 resStat = &sResBodyBonus;
Ritor1
parents:
diff changeset
2867 break;
Ritor1
parents:
diff changeset
2868 default: Error("Unexpected attribute");
Ritor1
parents:
diff changeset
2869 }
Ritor1
parents:
diff changeset
2870 baseRes = GetBaseResistance(a2);
Ritor1
parents:
diff changeset
2871 result = v10 + GetMagicalBonus(a2) + baseRes + *(resStat);
Ritor1
parents:
diff changeset
2872 if ( classType == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
2873 {
Ritor1
parents:
diff changeset
2874 if ( result > 200 )
Ritor1
parents:
diff changeset
2875 result = 200;
Ritor1
parents:
diff changeset
2876 }
Ritor1
parents:
diff changeset
2877 return result;
Ritor1
parents:
diff changeset
2878 }
Ritor1
parents:
diff changeset
2879
Ritor1
parents:
diff changeset
2880 //----- (0048E8F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
2881 bool Player::Recover(int dt)
Ritor1
parents:
diff changeset
2882 {
Ritor1
parents:
diff changeset
2883 int v3; // qax@1
Ritor1
parents:
diff changeset
2884
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2885 v3 = (int)(dt * GetSpecialItemBonus(ITEM_ENCHANTMENT_OF_RECOVERY) * 0.01 + dt);
2498
Ritor1
parents:
diff changeset
2886
Ritor1
parents:
diff changeset
2887 //Log::Warning(L"Recover(dt = %u/%u - %u", dt, (uint)v3, (uint)uTimeToRecovery);
Ritor1
parents:
diff changeset
2888
Ritor1
parents:
diff changeset
2889 if (uTimeToRecovery > v3)
Ritor1
parents:
diff changeset
2890 {
Ritor1
parents:
diff changeset
2891 uTimeToRecovery -= v3;
Ritor1
parents:
diff changeset
2892 return true;
Ritor1
parents:
diff changeset
2893 }
Ritor1
parents:
diff changeset
2894 else
Ritor1
parents:
diff changeset
2895 {
Ritor1
parents:
diff changeset
2896 uTimeToRecovery = 0;
Ritor1
parents:
diff changeset
2897 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
2898 if (!uActiveCharacter)
Ritor1
parents:
diff changeset
2899 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2900 return false;
Ritor1
parents:
diff changeset
2901 }
Ritor1
parents:
diff changeset
2902 }
Ritor1
parents:
diff changeset
2903
Ritor1
parents:
diff changeset
2904 //----- (0048E96A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2905 void Player::SetRecoveryTime(signed int rec)
Ritor1
parents:
diff changeset
2906 {
Ritor1
parents:
diff changeset
2907 Assert(rec >= 0);
Ritor1
parents:
diff changeset
2908
Ritor1
parents:
diff changeset
2909 if (rec > uTimeToRecovery)
Ritor1
parents:
diff changeset
2910 uTimeToRecovery = rec;
Ritor1
parents:
diff changeset
2911
Ritor1
parents:
diff changeset
2912 if (uActiveCharacter != 0 && pPlayers[uActiveCharacter] == this && !some_active_character)
Ritor1
parents:
diff changeset
2913 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
2914
Ritor1
parents:
diff changeset
2915 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
2916 }
Ritor1
parents:
diff changeset
2917 // 50C0C4: using guessed type int some_active_character;
Ritor1
parents:
diff changeset
2918
Ritor1
parents:
diff changeset
2919 //----- (0048E9B7) --------------------------------------------------------
Ritor1
parents:
diff changeset
2920 void Player::RandomizeName()
Ritor1
parents:
diff changeset
2921 {
Ritor1
parents:
diff changeset
2922 if (!uExpressionTimePassed)
Ritor1
parents:
diff changeset
2923 strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]);
Ritor1
parents:
diff changeset
2924 }
Ritor1
parents:
diff changeset
2925
Ritor1
parents:
diff changeset
2926 //----- (0048E9F4) --------------------------------------------------------
Ritor1
parents:
diff changeset
2927 unsigned int Player::GetMajorConditionIdx()
Ritor1
parents:
diff changeset
2928 {
Ritor1
parents:
diff changeset
2929 for (uint i = 0; i < 18; ++i)
Ritor1
parents:
diff changeset
2930 if (pConditions[pConditionImportancyTable[i]] != 0)
Ritor1
parents:
diff changeset
2931 return pConditionImportancyTable[i];
Ritor1
parents:
diff changeset
2932
Ritor1
parents:
diff changeset
2933 return 18;
Ritor1
parents:
diff changeset
2934 }
Ritor1
parents:
diff changeset
2935
Ritor1
parents:
diff changeset
2936 //----- (0048EA1B) --------------------------------------------------------
Ritor1
parents:
diff changeset
2937 int Player::GetParameterBonus( int player_parameter )
Ritor1
parents:
diff changeset
2938 {
Ritor1
parents:
diff changeset
2939 int i; // eax@1
Ritor1
parents:
diff changeset
2940 i = 0;
Ritor1
parents:
diff changeset
2941 while (param_to_bonus_table[i])
Ritor1
parents:
diff changeset
2942 {
Ritor1
parents:
diff changeset
2943 if (player_parameter >= param_to_bonus_table[i])
Ritor1
parents:
diff changeset
2944 break;
Ritor1
parents:
diff changeset
2945 ++i;
Ritor1
parents:
diff changeset
2946 }
Ritor1
parents:
diff changeset
2947 return parameter_to_bonus_value[i];
Ritor1
parents:
diff changeset
2948 }
Ritor1
parents:
diff changeset
2949
Ritor1
parents:
diff changeset
2950 //----- (0048EA46) --------------------------------------------------------
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2951 int Player::GetSpecialItemBonus(ITEM_ENCHANTMENT enchantment)
2498
Ritor1
parents:
diff changeset
2952 {
Ritor1
parents:
diff changeset
2953 for (int i = EQUIP_SINGLE_HANDED; i < EQUIP_BOOK; ++i )
Ritor1
parents:
diff changeset
2954 {
Ritor1
parents:
diff changeset
2955 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
2956 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2957 if (enchantment == ITEM_ENCHANTMENT_OF_RECOVERY)
2498
Ritor1
parents:
diff changeset
2958 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2959 if (GetNthEquippedIndexItem(i)->special_enchantment == ITEM_ENCHANTMENT_OF_RECOVERY
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2960 || (GetNthEquippedIndexItem(i)->uItemID == ITEM_ELVEN_CHAINMAIL)
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2961 )
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2962 return 50;
2498
Ritor1
parents:
diff changeset
2963 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2964 if (enchantment == ITEM_ENCHANTMENT_OF_FORCE)
2498
Ritor1
parents:
diff changeset
2965 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
2966 if (GetNthEquippedIndexItem(i)->special_enchantment == ITEM_ENCHANTMENT_OF_FORCE)
2498
Ritor1
parents:
diff changeset
2967 return 5;
Ritor1
parents:
diff changeset
2968 }
Ritor1
parents:
diff changeset
2969 }
Ritor1
parents:
diff changeset
2970 }
Ritor1
parents:
diff changeset
2971 return 0;
Ritor1
parents:
diff changeset
2972 }
Ritor1
parents:
diff changeset
2973
Ritor1
parents:
diff changeset
2974 //----- (0048EAAE) --------------------------------------------------------
Ritor1
parents:
diff changeset
2975 int Player::GetItemsBonus( enum CHARACTER_ATTRIBUTE_TYPE attr, bool getOnlyMainHandDmg /*= false*/ )
Ritor1
parents:
diff changeset
2976 {
Ritor1
parents:
diff changeset
2977 int v5; // edi@1
Ritor1
parents:
diff changeset
2978 int v9; // eax@49
Ritor1
parents:
diff changeset
2979 int v14; // ecx@58
Ritor1
parents:
diff changeset
2980 int v15; // eax@58
Ritor1
parents:
diff changeset
2981 int v17; // eax@62
Ritor1
parents:
diff changeset
2982 int v22; // eax@76
Ritor1
parents:
diff changeset
2983 int v25; // ecx@80
Ritor1
parents:
diff changeset
2984 int v26; // edi@80
Ritor1
parents:
diff changeset
2985 int v32; // eax@98
Ritor1
parents:
diff changeset
2986 int v56; // eax@365
Ritor1
parents:
diff changeset
2987 signed int v58; // [sp-4h] [bp-20h]@10
Ritor1
parents:
diff changeset
2988 int v61; // [sp+10h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2989 int v62; // [sp+14h] [bp-8h]@1
Ritor1
parents:
diff changeset
2990 ItemGen *currEquippedItem; // [sp+20h] [bp+4h]@101
Ritor1
parents:
diff changeset
2991 bool no_skills;
Ritor1
parents:
diff changeset
2992
Ritor1
parents:
diff changeset
2993 v5 = 0;
Ritor1
parents:
diff changeset
2994 v62 = 0;
Ritor1
parents:
diff changeset
2995 v61 = 0;
Ritor1
parents:
diff changeset
2996
Ritor1
parents:
diff changeset
2997 no_skills=false;
Ritor1
parents:
diff changeset
2998 switch (attr)
Ritor1
parents:
diff changeset
2999 {
Ritor1
parents:
diff changeset
3000 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: v58 = PLAYER_SKILL_ALCHEMY; break;
Ritor1
parents:
diff changeset
3001 case CHARACTER_ATTRIBUTE_SKILL_STEALING: v58 = PLAYER_SKILL_STEALING; break;
Ritor1
parents:
diff changeset
3002 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: v58 = PLAYER_SKILL_TRAP_DISARM; break;
Ritor1
parents:
diff changeset
3003 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: v58 = PLAYER_SKILL_ITEM_ID; break;
Ritor1
parents:
diff changeset
3004 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: v58 = PLAYER_SKILL_MONSTER_ID; break;
Ritor1
parents:
diff changeset
3005 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: v58 = PLAYER_SKILL_ARMSMASTER; break;
Ritor1
parents:
diff changeset
3006 case CHARACTER_ATTRIBUTE_SKILL_DODGE: v58 = PLAYER_SKILL_DODGE; break;
Ritor1
parents:
diff changeset
3007 case CHARACTER_ATTRIBUTE_SKILL_UNARMED: v58 = PLAYER_SKILL_UNARMED; break;
Ritor1
parents:
diff changeset
3008 case CHARACTER_ATTRIBUTE_SKILL_FIRE: v58 = PLAYER_SKILL_FIRE; break;
Ritor1
parents:
diff changeset
3009 case CHARACTER_ATTRIBUTE_SKILL_AIR: v58 = PLAYER_SKILL_AIR; break;
Ritor1
parents:
diff changeset
3010 case CHARACTER_ATTRIBUTE_SKILL_WATER: v58 = PLAYER_SKILL_WATER; break;
Ritor1
parents:
diff changeset
3011 case CHARACTER_ATTRIBUTE_SKILL_EARTH: v58 = PLAYER_SKILL_EARTH; break;
Ritor1
parents:
diff changeset
3012 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: v58 = PLAYER_SKILL_SPIRIT; break;
Ritor1
parents:
diff changeset
3013 case CHARACTER_ATTRIBUTE_SKILL_MIND: v58 = PLAYER_SKILL_MIND; break;
Ritor1
parents:
diff changeset
3014 case CHARACTER_ATTRIBUTE_SKILL_BODY: v58 = PLAYER_SKILL_BODY; break;
Ritor1
parents:
diff changeset
3015 case CHARACTER_ATTRIBUTE_SKILL_LIGHT: v58 = PLAYER_SKILL_LIGHT; break;
Ritor1
parents:
diff changeset
3016 case CHARACTER_ATTRIBUTE_SKILL_DARK: v58 = PLAYER_SKILL_DARK; break;
Ritor1
parents:
diff changeset
3017 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: v58 = PLAYER_SKILL_MEDITATION; break;
Ritor1
parents:
diff changeset
3018 case CHARACTER_ATTRIBUTE_SKILL_BOW: v58 = PLAYER_SKILL_BOW; break;
Ritor1
parents:
diff changeset
3019 case CHARACTER_ATTRIBUTE_SKILL_SHIELD: v58 = PLAYER_SKILL_SHIELD; break;
Ritor1
parents:
diff changeset
3020 case CHARACTER_ATTRIBUTE_SKILL_LEARNING: v58 = PLAYER_SKILL_LEARNING; break;
Ritor1
parents:
diff changeset
3021 default:
Ritor1
parents:
diff changeset
3022 no_skills=true;
Ritor1
parents:
diff changeset
3023 }
Ritor1
parents:
diff changeset
3024 if (!no_skills)
Ritor1
parents:
diff changeset
3025 {
Ritor1
parents:
diff changeset
3026 if ( !this->pActiveSkills[v58] )
Ritor1
parents:
diff changeset
3027 return 0;
Ritor1
parents:
diff changeset
3028 }
Ritor1
parents:
diff changeset
3029
Ritor1
parents:
diff changeset
3030 switch(attr) //TODO would be nice to move these into separate functions
Ritor1
parents:
diff changeset
3031 {
Ritor1
parents:
diff changeset
3032 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS:
Ritor1
parents:
diff changeset
3033 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3034 if ( HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3035 v5 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3036 return v5;
Ritor1
parents:
diff changeset
3037 break;
Ritor1
parents:
diff changeset
3038
Ritor1
parents:
diff changeset
3039 case CHARACTER_ATTRIBUTE_RANGED_DMG_MIN:
Ritor1
parents:
diff changeset
3040 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3041 return 0;
Ritor1
parents:
diff changeset
3042 v5 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3043 v56 = GetBowItem()->GetDamageDice();
Ritor1
parents:
diff changeset
3044 return v5 + v56;
Ritor1
parents:
diff changeset
3045 break;
Ritor1
parents:
diff changeset
3046
Ritor1
parents:
diff changeset
3047 case CHARACTER_ATTRIBUTE_RANGED_DMG_MAX:
Ritor1
parents:
diff changeset
3048 if ( !HasItemEquipped(EQUIP_BOW) )
Ritor1
parents:
diff changeset
3049 return 0;
Ritor1
parents:
diff changeset
3050 v5 = GetBowItem()->GetDamageDice() * GetBowItem()->GetDamageRoll();
Ritor1
parents:
diff changeset
3051 v56 = GetBowItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3052 return v5 + v56;
Ritor1
parents:
diff changeset
3053
Ritor1
parents:
diff changeset
3054 case CHARACTER_ATTRIBUTE_LEVEL:
Ritor1
parents:
diff changeset
3055 if ( !Player::HasEnchantedItemEquipped(25) )
Ritor1
parents:
diff changeset
3056 return 0;
Ritor1
parents:
diff changeset
3057 return 5;
Ritor1
parents:
diff changeset
3058 break;
Ritor1
parents:
diff changeset
3059
Ritor1
parents:
diff changeset
3060 case CHARACTER_ATTRIBUTE_MELEE_DMG_MAX:
Ritor1
parents:
diff changeset
3061 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3062 {
Ritor1
parents:
diff changeset
3063 return 3;
Ritor1
parents:
diff changeset
3064 }
Ritor1
parents:
diff changeset
3065 else
Ritor1
parents:
diff changeset
3066 {
Ritor1
parents:
diff changeset
3067 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3068 {
Ritor1
parents:
diff changeset
3069 v22 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3070 if ( v22 >= 0 && v22 <= 2)
Ritor1
parents:
diff changeset
3071 {
Ritor1
parents:
diff changeset
3072 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
3073 v26 = mainHandItem->GetDamageRoll();
Ritor1
parents:
diff changeset
3074 if ( GetOffHandItem() != nullptr || mainHandItem->GetPlayerSkillType() != 4 )
Ritor1
parents:
diff changeset
3075 {
Ritor1
parents:
diff changeset
3076 v25 = mainHandItem->GetDamageDice();
Ritor1
parents:
diff changeset
3077 }
Ritor1
parents:
diff changeset
3078 else
Ritor1
parents:
diff changeset
3079 {
Ritor1
parents:
diff changeset
3080 v25 = mainHandItem->GetDamageDice() + 1;
Ritor1
parents:
diff changeset
3081 }
Ritor1
parents:
diff changeset
3082 v5 = mainHandItem->GetDamageMod() + v25 * v26;
Ritor1
parents:
diff changeset
3083 }
Ritor1
parents:
diff changeset
3084 }
Ritor1
parents:
diff changeset
3085 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0 || GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2))
Ritor1
parents:
diff changeset
3086 {
Ritor1
parents:
diff changeset
3087 return v5;
Ritor1
parents:
diff changeset
3088 }
Ritor1
parents:
diff changeset
3089 else
Ritor1
parents:
diff changeset
3090 {
Ritor1
parents:
diff changeset
3091 ItemGen* offHandItem = GetOffHandItem();
Ritor1
parents:
diff changeset
3092 v15 = offHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3093 v14 = offHandItem->GetDamageDice() * offHandItem->GetDamageRoll();
Ritor1
parents:
diff changeset
3094 return v5 + v15 + v14;
Ritor1
parents:
diff changeset
3095 }
Ritor1
parents:
diff changeset
3096 }
Ritor1
parents:
diff changeset
3097 break;
Ritor1
parents:
diff changeset
3098
Ritor1
parents:
diff changeset
3099 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3100 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3101 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3102 {
Ritor1
parents:
diff changeset
3103 return 0;
Ritor1
parents:
diff changeset
3104 }
Ritor1
parents:
diff changeset
3105 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3106 {
Ritor1
parents:
diff changeset
3107 v17 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3108 if ( v17 >= 0 && v17 <= 2)
Ritor1
parents:
diff changeset
3109 {
Ritor1
parents:
diff changeset
3110 v5 = GetMainHandItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3111 }
Ritor1
parents:
diff changeset
3112 }
Ritor1
parents:
diff changeset
3113 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
Ritor1
parents:
diff changeset
3114 return v5;
Ritor1
parents:
diff changeset
3115 else
Ritor1
parents:
diff changeset
3116 {
Ritor1
parents:
diff changeset
3117 v56 = GetOffHandItem()->GetDamageMod();
Ritor1
parents:
diff changeset
3118 return v5 + v56;
Ritor1
parents:
diff changeset
3119 }
Ritor1
parents:
diff changeset
3120 break;
Ritor1
parents:
diff changeset
3121
Ritor1
parents:
diff changeset
3122 case CHARACTER_ATTRIBUTE_MELEE_DMG_MIN:
Ritor1
parents:
diff changeset
3123 if ( IsUnarmed() )
Ritor1
parents:
diff changeset
3124 {
Ritor1
parents:
diff changeset
3125 return 1;
Ritor1
parents:
diff changeset
3126 }
Ritor1
parents:
diff changeset
3127 if ( this->HasItemEquipped(EQUIP_TWO_HANDED) )
Ritor1
parents:
diff changeset
3128 {
Ritor1
parents:
diff changeset
3129 v9 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED);
Ritor1
parents:
diff changeset
3130 if ( v9 >= 0 && v9 <= 2)
Ritor1
parents:
diff changeset
3131 {
Ritor1
parents:
diff changeset
3132 ItemGen* mainHandItem = GetMainHandItem();
Ritor1
parents:
diff changeset
3133 v5 = mainHandItem->GetDamageDice() +
Ritor1
parents:
diff changeset
3134 mainHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3135 if ( GetOffHandItem() == nullptr && mainHandItem->GetPlayerSkillType() == 4)
Ritor1
parents:
diff changeset
3136 {
Ritor1
parents:
diff changeset
3137 ++v5;
Ritor1
parents:
diff changeset
3138 }
Ritor1
parents:
diff changeset
3139 }
Ritor1
parents:
diff changeset
3140 }
Ritor1
parents:
diff changeset
3141
Ritor1
parents:
diff changeset
3142 if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 )
Ritor1
parents:
diff changeset
3143 {
Ritor1
parents:
diff changeset
3144 return v5;
Ritor1
parents:
diff changeset
3145 }
Ritor1
parents:
diff changeset
3146 else
Ritor1
parents:
diff changeset
3147 {
Ritor1
parents:
diff changeset
3148 ItemGen* offHandItem = GetOffHandItem();
Ritor1
parents:
diff changeset
3149 v14 = offHandItem->GetDamageMod();
Ritor1
parents:
diff changeset
3150 v15 = offHandItem->GetDamageDice();
Ritor1
parents:
diff changeset
3151 return v5 + v15 + v14;
Ritor1
parents:
diff changeset
3152 }
Ritor1
parents:
diff changeset
3153 break;
Ritor1
parents:
diff changeset
3154
Ritor1
parents:
diff changeset
3155 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
3156 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
3157 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
3158 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
3159 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
3160 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
3161 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
3162 case CHARACTER_ATTRIBUTE_HEALTH:
Ritor1
parents:
diff changeset
3163 case CHARACTER_ATTRIBUTE_MANA:
Ritor1
parents:
diff changeset
3164 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3165
Ritor1
parents:
diff changeset
3166 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
3167 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
3168 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
3169 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
3170 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
3171 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
3172 case CHARACTER_ATTRIBUTE_RESIST_SPIRIT:
Ritor1
parents:
diff changeset
3173
Ritor1
parents:
diff changeset
3174 case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY:
Ritor1
parents:
diff changeset
3175 case CHARACTER_ATTRIBUTE_SKILL_STEALING:
Ritor1
parents:
diff changeset
3176 case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM:
Ritor1
parents:
diff changeset
3177 case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID:
Ritor1
parents:
diff changeset
3178 case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID:
Ritor1
parents:
diff changeset
3179 case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER:
Ritor1
parents:
diff changeset
3180 case CHARACTER_ATTRIBUTE_SKILL_DODGE:
Ritor1
parents:
diff changeset
3181 case CHARACTER_ATTRIBUTE_SKILL_UNARMED:
Ritor1
parents:
diff changeset
3182
Ritor1
parents:
diff changeset
3183 case CHARACTER_ATTRIBUTE_SKILL_FIRE:
Ritor1
parents:
diff changeset
3184 case CHARACTER_ATTRIBUTE_SKILL_AIR:
Ritor1
parents:
diff changeset
3185 case CHARACTER_ATTRIBUTE_SKILL_WATER:
Ritor1
parents:
diff changeset
3186 case CHARACTER_ATTRIBUTE_SKILL_EARTH:
Ritor1
parents:
diff changeset
3187 case CHARACTER_ATTRIBUTE_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
3188 case CHARACTER_ATTRIBUTE_SKILL_MIND:
Ritor1
parents:
diff changeset
3189 case CHARACTER_ATTRIBUTE_SKILL_BODY:
Ritor1
parents:
diff changeset
3190 case CHARACTER_ATTRIBUTE_SKILL_LIGHT:
Ritor1
parents:
diff changeset
3191 case CHARACTER_ATTRIBUTE_SKILL_DARK:
Ritor1
parents:
diff changeset
3192 case CHARACTER_ATTRIBUTE_SKILL_MEDITATION:
Ritor1
parents:
diff changeset
3193 case CHARACTER_ATTRIBUTE_SKILL_BOW:
Ritor1
parents:
diff changeset
3194 case CHARACTER_ATTRIBUTE_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3195 case CHARACTER_ATTRIBUTE_SKILL_LEARNING:
Ritor1
parents:
diff changeset
3196 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3197 {
Ritor1
parents:
diff changeset
3198 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3199 {
Ritor1
parents:
diff changeset
3200 currEquippedItem = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3201 if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS )
Ritor1
parents:
diff changeset
3202 {
Ritor1
parents:
diff changeset
3203 v32 = currEquippedItem->GetItemEquipType();
Ritor1
parents:
diff changeset
3204 if ( v32 >= 3 && v32 <= 11 )
Ritor1
parents:
diff changeset
3205 {
Ritor1
parents:
diff changeset
3206 v5 += currEquippedItem->GetDamageDice() + currEquippedItem->GetDamageMod();
Ritor1
parents:
diff changeset
3207 }
Ritor1
parents:
diff changeset
3208 }
Ritor1
parents:
diff changeset
3209 if ( pItemsTable->IsMaterialNonCommon(currEquippedItem)
Ritor1
parents:
diff changeset
3210 && !pItemsTable->IsMaterialSpecial(currEquippedItem) )
Ritor1
parents:
diff changeset
3211 {
Ritor1
parents:
diff changeset
3212 currEquippedItem->GetItemBonusArtifact(this, attr, &v62);
Ritor1
parents:
diff changeset
3213 }
Ritor1
parents:
diff changeset
3214 else if ( currEquippedItem->uEnchantmentType != 0 )
Ritor1
parents:
diff changeset
3215 {
Ritor1
parents:
diff changeset
3216 if (this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uEnchantmentType - 1 == attr)//if (currEquippedItem->IsRegularEnchanmentForAttribute(attr))
Ritor1
parents:
diff changeset
3217 {
Ritor1
parents:
diff changeset
3218 if ( attr > CHARACTER_ATTRIBUTE_RESIST_BODY && v5 < currEquippedItem->m_enchantmentStrength )//for skills bonuses
Ritor1
parents:
diff changeset
3219 v5 = currEquippedItem->m_enchantmentStrength;
Ritor1
parents:
diff changeset
3220 else // for resists and attributes bonuses
Ritor1
parents:
diff changeset
3221 v5 += currEquippedItem->m_enchantmentStrength;
Ritor1
parents:
diff changeset
3222 }
Ritor1
parents:
diff changeset
3223 }
Ritor1
parents:
diff changeset
3224 else
Ritor1
parents:
diff changeset
3225 {
Ritor1
parents:
diff changeset
3226 currEquippedItem->GetItemBonusSpecialEnchantment(this, attr, &v5, &v61);
Ritor1
parents:
diff changeset
3227 }
Ritor1
parents:
diff changeset
3228 }
Ritor1
parents:
diff changeset
3229 }
Ritor1
parents:
diff changeset
3230 return v5 + v62 + v61;
Ritor1
parents:
diff changeset
3231 break;
Ritor1
parents:
diff changeset
3232 default:
Ritor1
parents:
diff changeset
3233 return 0;
Ritor1
parents:
diff changeset
3234 }
Ritor1
parents:
diff changeset
3235 }
Ritor1
parents:
diff changeset
3236
Ritor1
parents:
diff changeset
3237 //----- (0048F73C) --------------------------------------------------------
Ritor1
parents:
diff changeset
3238 int Player::GetMagicalBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
Ritor1
parents:
diff changeset
3239 {
Ritor1
parents:
diff changeset
3240 int v3 = 0; // eax@4
Ritor1
parents:
diff changeset
3241 int v4 = 0; // ecx@5
Ritor1
parents:
diff changeset
3242
Ritor1
parents:
diff changeset
3243 switch ( a2 )
Ritor1
parents:
diff changeset
3244 {
Ritor1
parents:
diff changeset
3245 case CHARACTER_ATTRIBUTE_RESIST_FIRE:
Ritor1
parents:
diff changeset
3246 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].uPower;
Ritor1
parents:
diff changeset
3247 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].uPower;
Ritor1
parents:
diff changeset
3248 break;
Ritor1
parents:
diff changeset
3249 case CHARACTER_ATTRIBUTE_RESIST_AIR:
Ritor1
parents:
diff changeset
3250 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].uPower;
Ritor1
parents:
diff changeset
3251 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].uPower;
Ritor1
parents:
diff changeset
3252 break;
Ritor1
parents:
diff changeset
3253 case CHARACTER_ATTRIBUTE_RESIST_BODY:
Ritor1
parents:
diff changeset
3254 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].uPower;
Ritor1
parents:
diff changeset
3255 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].uPower;
Ritor1
parents:
diff changeset
3256 break;
Ritor1
parents:
diff changeset
3257 case CHARACTER_ATTRIBUTE_RESIST_WATER:
Ritor1
parents:
diff changeset
3258 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].uPower;
Ritor1
parents:
diff changeset
3259 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].uPower;
Ritor1
parents:
diff changeset
3260 break;
Ritor1
parents:
diff changeset
3261 case CHARACTER_ATTRIBUTE_RESIST_EARTH:
Ritor1
parents:
diff changeset
3262 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].uPower;
Ritor1
parents:
diff changeset
3263 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].uPower;
Ritor1
parents:
diff changeset
3264 break;
Ritor1
parents:
diff changeset
3265 case CHARACTER_ATTRIBUTE_RESIST_MIND:
Ritor1
parents:
diff changeset
3266 v3 = this->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].uPower;
Ritor1
parents:
diff changeset
3267 v4 = pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].uPower;
Ritor1
parents:
diff changeset
3268 break;
Ritor1
parents:
diff changeset
3269 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3270 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3271 v3 = this->pPlayerBuffs[PLAYER_BUFF_BLESS].uPower; //only player effect spell in both VI and VII
Ritor1
parents:
diff changeset
3272 break;
Ritor1
parents:
diff changeset
3273 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3274 v3 = this->pPlayerBuffs[PLAYER_BUFF_HEROISM].uPower;
Ritor1
parents:
diff changeset
3275 v4 = pParty->pPartyBuffs[PARTY_BUFF_HEROISM].uPower;
Ritor1
parents:
diff changeset
3276 break;
Ritor1
parents:
diff changeset
3277 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
3278 v3 = pPlayerBuffs[PLAYER_BUFF_STRENGTH].uPower;
Ritor1
parents:
diff changeset
3279 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3280 break;
Ritor1
parents:
diff changeset
3281 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
3282 v3 = pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].uPower;
Ritor1
parents:
diff changeset
3283 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3284 break;
Ritor1
parents:
diff changeset
3285 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
3286 v3 = pPlayerBuffs[PLAYER_BUFF_WILLPOWER].uPower;
Ritor1
parents:
diff changeset
3287 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3288 break;
Ritor1
parents:
diff changeset
3289 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
3290 v3 = pPlayerBuffs[PLAYER_BUFF_ENDURANCE].uPower;
Ritor1
parents:
diff changeset
3291 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3292 break;
Ritor1
parents:
diff changeset
3293 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
3294 v3 = pPlayerBuffs[PLAYER_BUFF_ACCURACY].uPower;
Ritor1
parents:
diff changeset
3295 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3296 break;
Ritor1
parents:
diff changeset
3297 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
3298 v3 = pPlayerBuffs[PLAYER_BUFF_SPEED].uPower;
Ritor1
parents:
diff changeset
3299 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3300 break;
Ritor1
parents:
diff changeset
3301 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
3302 v3 = pPlayerBuffs[PLAYER_BUFF_LUCK].uPower;
Ritor1
parents:
diff changeset
3303 v4 = pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].uPower;
Ritor1
parents:
diff changeset
3304 break;
Ritor1
parents:
diff changeset
3305 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3306 v3 = this->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uPower;
Ritor1
parents:
diff changeset
3307 v4 = pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].uPower;
Ritor1
parents:
diff changeset
3308 break;
Ritor1
parents:
diff changeset
3309 }
Ritor1
parents:
diff changeset
3310 return v3 + v4;
Ritor1
parents:
diff changeset
3311 }
Ritor1
parents:
diff changeset
3312
Ritor1
parents:
diff changeset
3313 //----- (0048F882) --------------------------------------------------------
Ritor1
parents:
diff changeset
3314 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType )
Ritor1
parents:
diff changeset
3315 {
Ritor1
parents:
diff changeset
3316 signed int bonus_value; // esi@1
Ritor1
parents:
diff changeset
3317 unsigned __int16 skill_value; // ax@126
Ritor1
parents:
diff changeset
3318 int result; // al@127
Ritor1
parents:
diff changeset
3319
Ritor1
parents:
diff changeset
3320 bonus_value = 0;
Ritor1
parents:
diff changeset
3321 switch (uSkillType)
Ritor1
parents:
diff changeset
3322 {
Ritor1
parents:
diff changeset
3323 case PLAYER_SKILL_MONSTER_ID:
Ritor1
parents:
diff changeset
3324 {
Ritor1
parents:
diff changeset
3325 if ( CheckHiredNPCSpeciality(Hunter) )
Ritor1
parents:
diff changeset
3326 bonus_value = 6;
Ritor1
parents:
diff changeset
3327 if ( CheckHiredNPCSpeciality(Sage) )
Ritor1
parents:
diff changeset
3328 bonus_value += 6;
Ritor1
parents:
diff changeset
3329 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID);
Ritor1
parents:
diff changeset
3330 }
Ritor1
parents:
diff changeset
3331 break;
Ritor1
parents:
diff changeset
3332
Ritor1
parents:
diff changeset
3333 case PLAYER_SKILL_ARMSMASTER:
Ritor1
parents:
diff changeset
3334 {
Ritor1
parents:
diff changeset
3335 if ( CheckHiredNPCSpeciality(Armsmaster) )
Ritor1
parents:
diff changeset
3336 bonus_value = 2;
Ritor1
parents:
diff changeset
3337 if ( CheckHiredNPCSpeciality(Weaponsmaster) )
Ritor1
parents:
diff changeset
3338 bonus_value += 3;
Ritor1
parents:
diff changeset
3339 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER);
Ritor1
parents:
diff changeset
3340 }
Ritor1
parents:
diff changeset
3341 break;
Ritor1
parents:
diff changeset
3342
Ritor1
parents:
diff changeset
3343 case PLAYER_SKILL_STEALING:
Ritor1
parents:
diff changeset
3344 {
Ritor1
parents:
diff changeset
3345 if (CheckHiredNPCSpeciality(Burglar))
Ritor1
parents:
diff changeset
3346 bonus_value = 8;
Ritor1
parents:
diff changeset
3347 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_STEALING);
Ritor1
parents:
diff changeset
3348 }
Ritor1
parents:
diff changeset
3349 break;
Ritor1
parents:
diff changeset
3350
Ritor1
parents:
diff changeset
3351
Ritor1
parents:
diff changeset
3352 case PLAYER_SKILL_ALCHEMY:
Ritor1
parents:
diff changeset
3353 {
Ritor1
parents:
diff changeset
3354 if ( CheckHiredNPCSpeciality(Herbalist) )
Ritor1
parents:
diff changeset
3355 bonus_value = 4;
Ritor1
parents:
diff changeset
3356 if ( CheckHiredNPCSpeciality(Apothecary) )
Ritor1
parents:
diff changeset
3357 bonus_value += 8;
Ritor1
parents:
diff changeset
3358 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY);
Ritor1
parents:
diff changeset
3359 }
Ritor1
parents:
diff changeset
3360 break;
Ritor1
parents:
diff changeset
3361
Ritor1
parents:
diff changeset
3362 case PLAYER_SKILL_LEARNING:
Ritor1
parents:
diff changeset
3363 {
Ritor1
parents:
diff changeset
3364 if ( CheckHiredNPCSpeciality(Teacher) )
Ritor1
parents:
diff changeset
3365 bonus_value = 10;
Ritor1
parents:
diff changeset
3366 if ( CheckHiredNPCSpeciality(Instructor) )
Ritor1
parents:
diff changeset
3367 bonus_value += 15;
Ritor1
parents:
diff changeset
3368 if ( CheckHiredNPCSpeciality(Scholar) )
Ritor1
parents:
diff changeset
3369 bonus_value += 5;
Ritor1
parents:
diff changeset
3370 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LEARNING);
Ritor1
parents:
diff changeset
3371 }
Ritor1
parents:
diff changeset
3372 break;
Ritor1
parents:
diff changeset
3373
Ritor1
parents:
diff changeset
3374 case PLAYER_SKILL_UNARMED:
Ritor1
parents:
diff changeset
3375 {
Ritor1
parents:
diff changeset
3376 if (CheckHiredNPCSpeciality(Monk) )
Ritor1
parents:
diff changeset
3377 bonus_value = 2;
Ritor1
parents:
diff changeset
3378 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3379 }
Ritor1
parents:
diff changeset
3380 break;
Ritor1
parents:
diff changeset
3381
Ritor1
parents:
diff changeset
3382 case PLAYER_SKILL_DODGE:
Ritor1
parents:
diff changeset
3383 {
Ritor1
parents:
diff changeset
3384 if ( CheckHiredNPCSpeciality(Monk) )
Ritor1
parents:
diff changeset
3385 bonus_value = 2;
Ritor1
parents:
diff changeset
3386 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DODGE);
Ritor1
parents:
diff changeset
3387 }
Ritor1
parents:
diff changeset
3388 break;
Ritor1
parents:
diff changeset
3389
Ritor1
parents:
diff changeset
3390 case PLAYER_SKILL_BOW:
Ritor1
parents:
diff changeset
3391 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BOW);
Ritor1
parents:
diff changeset
3392 break;
Ritor1
parents:
diff changeset
3393 case PLAYER_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3394 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SHIELD);
Ritor1
parents:
diff changeset
3395 break;
Ritor1
parents:
diff changeset
3396
Ritor1
parents:
diff changeset
3397 case PLAYER_SKILL_EARTH:
Ritor1
parents:
diff changeset
3398 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3399 bonus_value = 2;
Ritor1
parents:
diff changeset
3400 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3401 bonus_value += 3;
Ritor1
parents:
diff changeset
3402 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3403 bonus_value += 4;
Ritor1
parents:
diff changeset
3404 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3405 bonus_value += 3;
Ritor1
parents:
diff changeset
3406 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_EARTH);
Ritor1
parents:
diff changeset
3407 break;
Ritor1
parents:
diff changeset
3408 case PLAYER_SKILL_FIRE:
Ritor1
parents:
diff changeset
3409 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3410 bonus_value = 2;
Ritor1
parents:
diff changeset
3411 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3412 bonus_value += 3;
Ritor1
parents:
diff changeset
3413 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3414 bonus_value += 4;
Ritor1
parents:
diff changeset
3415 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3416 bonus_value += 3;
Ritor1
parents:
diff changeset
3417 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_FIRE);
Ritor1
parents:
diff changeset
3418 break;
Ritor1
parents:
diff changeset
3419 case PLAYER_SKILL_AIR:
Ritor1
parents:
diff changeset
3420 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3421 bonus_value = 2;
Ritor1
parents:
diff changeset
3422 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3423 bonus_value += 3;
Ritor1
parents:
diff changeset
3424 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3425 bonus_value += 4;
Ritor1
parents:
diff changeset
3426 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3427 bonus_value += 3;
Ritor1
parents:
diff changeset
3428 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_AIR);
Ritor1
parents:
diff changeset
3429 break;
Ritor1
parents:
diff changeset
3430 case PLAYER_SKILL_WATER:
Ritor1
parents:
diff changeset
3431 if ( CheckHiredNPCSpeciality(Apprentice) )
Ritor1
parents:
diff changeset
3432 bonus_value = 2;
Ritor1
parents:
diff changeset
3433 if ( CheckHiredNPCSpeciality(Mystic) )
Ritor1
parents:
diff changeset
3434 bonus_value += 3;
Ritor1
parents:
diff changeset
3435 if ( CheckHiredNPCSpeciality(Spellmaster) )
Ritor1
parents:
diff changeset
3436 bonus_value += 4;
Ritor1
parents:
diff changeset
3437 if ( classType == PLAYER_CLASS_WARLOCK && PartyHasDragon() )
Ritor1
parents:
diff changeset
3438 bonus_value += 3;
Ritor1
parents:
diff changeset
3439 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_WATER);
Ritor1
parents:
diff changeset
3440 break;
Ritor1
parents:
diff changeset
3441 case PLAYER_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
3442 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3443 bonus_value = 2;
Ritor1
parents:
diff changeset
3444 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3445 bonus_value += 3;
Ritor1
parents:
diff changeset
3446 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3447 bonus_value += 4;
Ritor1
parents:
diff changeset
3448 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_SPIRIT);
Ritor1
parents:
diff changeset
3449 break;
Ritor1
parents:
diff changeset
3450 case PLAYER_SKILL_MIND:
Ritor1
parents:
diff changeset
3451 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3452 bonus_value = 2;
Ritor1
parents:
diff changeset
3453 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3454 bonus_value += 3;
Ritor1
parents:
diff changeset
3455 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3456 bonus_value += 4;
Ritor1
parents:
diff changeset
3457 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MIND);
Ritor1
parents:
diff changeset
3458 break;
Ritor1
parents:
diff changeset
3459 case PLAYER_SKILL_BODY:
Ritor1
parents:
diff changeset
3460 if ( CheckHiredNPCSpeciality(Acolyte2) )
Ritor1
parents:
diff changeset
3461 bonus_value = 2;
Ritor1
parents:
diff changeset
3462 if ( CheckHiredNPCSpeciality(Initiate) )
Ritor1
parents:
diff changeset
3463 bonus_value += 3;
Ritor1
parents:
diff changeset
3464 if ( CheckHiredNPCSpeciality(Prelate) )
Ritor1
parents:
diff changeset
3465 bonus_value += 4;
Ritor1
parents:
diff changeset
3466 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_BODY);
Ritor1
parents:
diff changeset
3467 break;
Ritor1
parents:
diff changeset
3468 case PLAYER_SKILL_LIGHT:
Ritor1
parents:
diff changeset
3469 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_LIGHT);
Ritor1
parents:
diff changeset
3470 break;
Ritor1
parents:
diff changeset
3471 case PLAYER_SKILL_DARK:
Ritor1
parents:
diff changeset
3472 {
Ritor1
parents:
diff changeset
3473 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_DARK);
Ritor1
parents:
diff changeset
3474 }
Ritor1
parents:
diff changeset
3475 break;
Ritor1
parents:
diff changeset
3476
Ritor1
parents:
diff changeset
3477 case PLAYER_SKILL_MERCHANT:
Ritor1
parents:
diff changeset
3478 {
Ritor1
parents:
diff changeset
3479 if ( CheckHiredNPCSpeciality(Trader) )
Ritor1
parents:
diff changeset
3480 bonus_value = 4;
Ritor1
parents:
diff changeset
3481 if ( CheckHiredNPCSpeciality(Merchant) )
Ritor1
parents:
diff changeset
3482 bonus_value += 6;
Ritor1
parents:
diff changeset
3483 if ( CheckHiredNPCSpeciality(Gypsy) )
Ritor1
parents:
diff changeset
3484 bonus_value += 3;
Ritor1
parents:
diff changeset
3485 if ( CheckHiredNPCSpeciality(Duper) )
Ritor1
parents:
diff changeset
3486 bonus_value += 8;
Ritor1
parents:
diff changeset
3487 }
Ritor1
parents:
diff changeset
3488 break;
Ritor1
parents:
diff changeset
3489
Ritor1
parents:
diff changeset
3490 case PLAYER_SKILL_PERCEPTION:
Ritor1
parents:
diff changeset
3491 {
Ritor1
parents:
diff changeset
3492 if ( CheckHiredNPCSpeciality(Scout) )
Ritor1
parents:
diff changeset
3493 bonus_value = 6;
Ritor1
parents:
diff changeset
3494 if ( CheckHiredNPCSpeciality(Psychic) )
Ritor1
parents:
diff changeset
3495 bonus_value += 5;
Ritor1
parents:
diff changeset
3496 }
Ritor1
parents:
diff changeset
3497 break;
Ritor1
parents:
diff changeset
3498
Ritor1
parents:
diff changeset
3499 case PLAYER_SKILL_ITEM_ID:
Ritor1
parents:
diff changeset
3500 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID);
Ritor1
parents:
diff changeset
3501 break;
Ritor1
parents:
diff changeset
3502 case PLAYER_SKILL_MEDITATION:
Ritor1
parents:
diff changeset
3503 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_MEDITATION);
Ritor1
parents:
diff changeset
3504 break;
Ritor1
parents:
diff changeset
3505 case PLAYER_SKILL_TRAP_DISARM:
Ritor1
parents:
diff changeset
3506 {
Ritor1
parents:
diff changeset
3507 if ( CheckHiredNPCSpeciality(Tinker) )
Ritor1
parents:
diff changeset
3508 bonus_value = 4;
Ritor1
parents:
diff changeset
3509 if ( CheckHiredNPCSpeciality(Locksmith) )
Ritor1
parents:
diff changeset
3510 bonus_value += 6;
Ritor1
parents:
diff changeset
3511 if ( CheckHiredNPCSpeciality(Burglar) )
Ritor1
parents:
diff changeset
3512 bonus_value += 8;
Ritor1
parents:
diff changeset
3513 bonus_value += GetItemsBonus(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM);
Ritor1
parents:
diff changeset
3514 }
Ritor1
parents:
diff changeset
3515 break;
Ritor1
parents:
diff changeset
3516 }
Ritor1
parents:
diff changeset
3517
Ritor1
parents:
diff changeset
3518 skill_value = pActiveSkills[uSkillType];
Ritor1
parents:
diff changeset
3519 if ( bonus_value + (skill_value & 0x3F) < 60 )
Ritor1
parents:
diff changeset
3520 result = bonus_value + skill_value;
Ritor1
parents:
diff changeset
3521 else
Ritor1
parents:
diff changeset
3522 result = skill_value & 0xFFFC | 0x3C; //al
Ritor1
parents:
diff changeset
3523 return result;
Ritor1
parents:
diff changeset
3524 }
Ritor1
parents:
diff changeset
3525
Ritor1
parents:
diff changeset
3526
Ritor1
parents:
diff changeset
3527 //----- (0048FC00) --------------------------------------------------------
Ritor1
parents:
diff changeset
3528 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE inSkill) //TODO: move the individual implementations to attribute classes once possible
Ritor1
parents:
diff changeset
3529 {
Ritor1
parents:
diff changeset
3530 int armsMasterBonus;
Ritor1
parents:
diff changeset
3531
Ritor1
parents:
diff changeset
3532 armsMasterBonus = 0;
Ritor1
parents:
diff changeset
3533 int armmaster_skill = GetActualSkillLevel(PLAYER_SKILL_ARMSMASTER);
Ritor1
parents:
diff changeset
3534 if ( armmaster_skill > 0 )
Ritor1
parents:
diff changeset
3535 {
Ritor1
parents:
diff changeset
3536 int multiplier = 0;
Ritor1
parents:
diff changeset
3537 if ( inSkill == CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS )
Ritor1
parents:
diff changeset
3538 {
Ritor1
parents:
diff changeset
3539 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 0, 1, 2);
Ritor1
parents:
diff changeset
3540 }
Ritor1
parents:
diff changeset
3541 else if ( inSkill == CHARACTER_ATTRIBUTE_ATTACK )
Ritor1
parents:
diff changeset
3542 {
Ritor1
parents:
diff changeset
3543 multiplier = GetMultiplierForSkillLevel(armmaster_skill, 0, 1, 1, 2);
Ritor1
parents:
diff changeset
3544 }
Ritor1
parents:
diff changeset
3545 armsMasterBonus = multiplier * (armmaster_skill & 0x3F);
Ritor1
parents:
diff changeset
3546 }
Ritor1
parents:
diff changeset
3547
Ritor1
parents:
diff changeset
3548 switch(inSkill)
Ritor1
parents:
diff changeset
3549 {
Ritor1
parents:
diff changeset
3550 case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS:
Ritor1
parents:
diff changeset
3551 if (HasItemEquipped(EQUIP_BOW))
Ritor1
parents:
diff changeset
3552 {
Ritor1
parents:
diff changeset
3553 int bowSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE);
Ritor1
parents:
diff changeset
3554 int multiplier = GetMultiplierForSkillLevel(bowSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3555 return multiplier * (bowSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3556 }
Ritor1
parents:
diff changeset
3557 return 0;
Ritor1
parents:
diff changeset
3558 break;
Ritor1
parents:
diff changeset
3559 case CHARACTER_ATTRIBUTE_HEALTH:
Ritor1
parents:
diff changeset
3560 {
Ritor1
parents:
diff changeset
3561 int base_value = pBaseHealthPerLevelByClass[classType];
Ritor1
parents:
diff changeset
3562 int attrib_modif = GetBodybuilding();
Ritor1
parents:
diff changeset
3563 return base_value * attrib_modif;
Ritor1
parents:
diff changeset
3564 }
Ritor1
parents:
diff changeset
3565 break;
Ritor1
parents:
diff changeset
3566 case CHARACTER_ATTRIBUTE_MANA:
Ritor1
parents:
diff changeset
3567 {
Ritor1
parents:
diff changeset
3568 int base_value = pBaseManaPerLevelByClass[classType];
Ritor1
parents:
diff changeset
3569 int attrib_modif = GetMeditation();
Ritor1
parents:
diff changeset
3570 return base_value * attrib_modif;
Ritor1
parents:
diff changeset
3571 }
Ritor1
parents:
diff changeset
3572 break;
Ritor1
parents:
diff changeset
3573 case CHARACTER_ATTRIBUTE_AC_BONUS:
Ritor1
parents:
diff changeset
3574 {
Ritor1
parents:
diff changeset
3575 bool wearingArmor = false;
Ritor1
parents:
diff changeset
3576 bool wearingLeather = false;
Ritor1
parents:
diff changeset
3577 unsigned int ACSum = 0;
Ritor1
parents:
diff changeset
3578
Ritor1
parents:
diff changeset
3579 for (int j = 0; j < 16; ++j)
Ritor1
parents:
diff changeset
3580 {
Ritor1
parents:
diff changeset
3581 ItemGen* currItem = GetNthEquippedIndexItem(j);
Ritor1
parents:
diff changeset
3582 if (currItem != nullptr && (!currItem->IsBroken()))
Ritor1
parents:
diff changeset
3583 {
Ritor1
parents:
diff changeset
3584 PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3585 int currArmorSkillLevel = 0;
Ritor1
parents:
diff changeset
3586 int multiplier = 0;
Ritor1
parents:
diff changeset
3587 switch (itemSkillType)
Ritor1
parents:
diff changeset
3588 {
Ritor1
parents:
diff changeset
3589 case PLAYER_SKILL_STAFF:
Ritor1
parents:
diff changeset
3590 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3591 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 1, 1, 1);
Ritor1
parents:
diff changeset
3592 break;
Ritor1
parents:
diff changeset
3593 case PLAYER_SKILL_SWORD:
Ritor1
parents:
diff changeset
3594 case PLAYER_SKILL_SPEAR:
Ritor1
parents:
diff changeset
3595 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3596 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3597 break;
Ritor1
parents:
diff changeset
3598 case PLAYER_SKILL_SHIELD:
Ritor1
parents:
diff changeset
3599 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3600 wearingArmor = true;
Ritor1
parents:
diff changeset
3601 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3602 break;
Ritor1
parents:
diff changeset
3603 case PLAYER_SKILL_LEATHER:
Ritor1
parents:
diff changeset
3604 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3605 wearingLeather = true;
Ritor1
parents:
diff changeset
3606 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3607 break;
Ritor1
parents:
diff changeset
3608 case PLAYER_SKILL_CHAIN:
Ritor1
parents:
diff changeset
3609 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3610 wearingArmor = true;
Ritor1
parents:
diff changeset
3611 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3612 break;
Ritor1
parents:
diff changeset
3613 case PLAYER_SKILL_PLATE:
Ritor1
parents:
diff changeset
3614 currArmorSkillLevel = GetActualSkillLevel(itemSkillType);
Ritor1
parents:
diff changeset
3615 wearingArmor = true;
Ritor1
parents:
diff changeset
3616 multiplier = GetMultiplierForSkillLevel(currArmorSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3617 break;
Ritor1
parents:
diff changeset
3618 }
Ritor1
parents:
diff changeset
3619 ACSum += multiplier * (currArmorSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3620 }
Ritor1
parents:
diff changeset
3621 }
Ritor1
parents:
diff changeset
3622
Ritor1
parents:
diff changeset
3623 int dodgeSkillLevel = GetActualSkillLevel(PLAYER_SKILL_DODGE);
Ritor1
parents:
diff changeset
3624 int dodgeMastery = SkillToMastery(dodgeSkillLevel);
Ritor1
parents:
diff changeset
3625 int multiplier = GetMultiplierForSkillLevel(dodgeSkillLevel, 1, 2, 3, 3);
Ritor1
parents:
diff changeset
3626 if ( !wearingArmor && (!wearingLeather || dodgeMastery == 4) )
Ritor1
parents:
diff changeset
3627 {
Ritor1
parents:
diff changeset
3628 ACSum += multiplier * (dodgeSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3629 }
Ritor1
parents:
diff changeset
3630 return ACSum;
Ritor1
parents:
diff changeset
3631 }
Ritor1
parents:
diff changeset
3632 break;
Ritor1
parents:
diff changeset
3633 case CHARACTER_ATTRIBUTE_ATTACK:
Ritor1
parents:
diff changeset
3634 if ( this->IsUnarmed() )
Ritor1
parents:
diff changeset
3635 {
Ritor1
parents:
diff changeset
3636 int unarmedSkill = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3637 if (!unarmedSkill)
Ritor1
parents:
diff changeset
3638 {
Ritor1
parents:
diff changeset
3639 return 0;
Ritor1
parents:
diff changeset
3640 }
Ritor1
parents:
diff changeset
3641 int multiplier = GetMultiplierForSkillLevel(unarmedSkill, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3642 return armsMasterBonus + multiplier * (unarmedSkill & 0x3F);
Ritor1
parents:
diff changeset
3643 }
Ritor1
parents:
diff changeset
3644 for (int i = 0; i < 16; ++i)
Ritor1
parents:
diff changeset
3645 {
Ritor1
parents:
diff changeset
3646 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3647 {
Ritor1
parents:
diff changeset
3648 ItemGen* currItem = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3649 if ( currItem->GetItemEquipType() <= EQUIP_TWO_HANDED)
Ritor1
parents:
diff changeset
3650 {
Ritor1
parents:
diff changeset
3651 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3652 int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
Ritor1
parents:
diff changeset
3653 if (currItemSkillType == PLAYER_SKILL_BLASTER)
Ritor1
parents:
diff changeset
3654 {
Ritor1
parents:
diff changeset
3655 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
3656 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3657 }
Ritor1
parents:
diff changeset
3658 else if (currItemSkillType == PLAYER_SKILL_STAFF && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
3659 {
Ritor1
parents:
diff changeset
3660 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3661 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 2, 2);
Ritor1
parents:
diff changeset
3662 return multiplier * (unarmedSkillLevel & 0x3F) + armsMasterBonus + (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3663 }
Ritor1
parents:
diff changeset
3664 else
Ritor1
parents:
diff changeset
3665 {
Ritor1
parents:
diff changeset
3666 return armsMasterBonus + (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3667 }
Ritor1
parents:
diff changeset
3668 }
Ritor1
parents:
diff changeset
3669 }
Ritor1
parents:
diff changeset
3670 }
Ritor1
parents:
diff changeset
3671 return 0;
Ritor1
parents:
diff changeset
3672 break;
Ritor1
parents:
diff changeset
3673
Ritor1
parents:
diff changeset
3674 case CHARACTER_ATTRIBUTE_RANGED_ATTACK:
Ritor1
parents:
diff changeset
3675 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3676 {
Ritor1
parents:
diff changeset
3677 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3678 {
Ritor1
parents:
diff changeset
3679 ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3680 if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
Ritor1
parents:
diff changeset
3681 {
Ritor1
parents:
diff changeset
3682 PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(i)->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3683 int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType);
Ritor1
parents:
diff changeset
3684 if ( currentItemSkillType == PLAYER_SKILL_BOW )
Ritor1
parents:
diff changeset
3685 {
Ritor1
parents:
diff changeset
3686 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1);
Ritor1
parents:
diff changeset
3687 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3688 }
Ritor1
parents:
diff changeset
3689 else if ( currentItemSkillType == PLAYER_SKILL_BLASTER )
Ritor1
parents:
diff changeset
3690 {
Ritor1
parents:
diff changeset
3691 int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
Ritor1
parents:
diff changeset
3692 return multiplier * (currentItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3693 }
Ritor1
parents:
diff changeset
3694 }
Ritor1
parents:
diff changeset
3695 }
Ritor1
parents:
diff changeset
3696 }
Ritor1
parents:
diff changeset
3697 return 0;
Ritor1
parents:
diff changeset
3698 break;
Ritor1
parents:
diff changeset
3699
Ritor1
parents:
diff changeset
3700 case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS:
Ritor1
parents:
diff changeset
3701 if ( this->IsUnarmed() )
Ritor1
parents:
diff changeset
3702 {
Ritor1
parents:
diff changeset
3703 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3704 if ( !unarmedSkillLevel )
Ritor1
parents:
diff changeset
3705 {
Ritor1
parents:
diff changeset
3706 return 0;
Ritor1
parents:
diff changeset
3707 }
Ritor1
parents:
diff changeset
3708 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3709 return multiplier * (unarmedSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3710 }
Ritor1
parents:
diff changeset
3711 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
3712 {
Ritor1
parents:
diff changeset
3713 if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
Ritor1
parents:
diff changeset
3714 {
Ritor1
parents:
diff changeset
3715 ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
Ritor1
parents:
diff changeset
3716 if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
Ritor1
parents:
diff changeset
3717 {
Ritor1
parents:
diff changeset
3718 PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType();
Ritor1
parents:
diff changeset
3719 int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType);
Ritor1
parents:
diff changeset
3720 int baseSkillBonus;
Ritor1
parents:
diff changeset
3721 int multiplier;
Ritor1
parents:
diff changeset
3722 switch (currItemSkillType)
Ritor1
parents:
diff changeset
3723 {
Ritor1
parents:
diff changeset
3724 case PLAYER_SKILL_STAFF:
Ritor1
parents:
diff changeset
3725 if ( SkillToMastery(currItemSkillLevel) >= 4 && this->GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0)
Ritor1
parents:
diff changeset
3726 {
Ritor1
parents:
diff changeset
3727 int unarmedSkillLevel = this->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
3728 int multiplier = GetMultiplierForSkillLevel(unarmedSkillLevel, 0, 1, 2, 2);
Ritor1
parents:
diff changeset
3729 return multiplier * (unarmedSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3730 }
Ritor1
parents:
diff changeset
3731 else
Ritor1
parents:
diff changeset
3732 {
Ritor1
parents:
diff changeset
3733 return armsMasterBonus;
Ritor1
parents:
diff changeset
3734 }
Ritor1
parents:
diff changeset
3735 break;
Ritor1
parents:
diff changeset
3736
Ritor1
parents:
diff changeset
3737 case PLAYER_SKILL_DAGGER:
Ritor1
parents:
diff changeset
3738 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 1);
Ritor1
parents:
diff changeset
3739 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3740 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3741 break;
Ritor1
parents:
diff changeset
3742 case PLAYER_SKILL_SWORD:
Ritor1
parents:
diff changeset
3743 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
3744 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3745 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3746 break;
Ritor1
parents:
diff changeset
3747 case PLAYER_SKILL_MACE:
Ritor1
parents:
diff changeset
3748 case PLAYER_SKILL_SPEAR:
Ritor1
parents:
diff changeset
3749 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 1, 1, 1);
Ritor1
parents:
diff changeset
3750 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3751 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3752 break;
Ritor1
parents:
diff changeset
3753 case PLAYER_SKILL_AXE:
Ritor1
parents:
diff changeset
3754 multiplier = GetMultiplierForSkillLevel(currItemSkillLevel, 0, 0, 1, 1);
Ritor1
parents:
diff changeset
3755 baseSkillBonus = multiplier * (currItemSkillLevel & 0x3F);
Ritor1
parents:
diff changeset
3756 return armsMasterBonus + baseSkillBonus;
Ritor1
parents:
diff changeset
3757 break;
Ritor1
parents:
diff changeset
3758 }
Ritor1
parents:
diff changeset
3759 }
Ritor1
parents:
diff changeset
3760 }
Ritor1
parents:
diff changeset
3761 }
Ritor1
parents:
diff changeset
3762 return 0;
Ritor1
parents:
diff changeset
3763 break;
Ritor1
parents:
diff changeset
3764 default:
Ritor1
parents:
diff changeset
3765 return 0;
Ritor1
parents:
diff changeset
3766 }
Ritor1
parents:
diff changeset
3767 }
Ritor1
parents:
diff changeset
3768
Ritor1
parents:
diff changeset
3769 unsigned int Player::GetMultiplierForSkillLevel(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4)
Ritor1
parents:
diff changeset
3770 {
Ritor1
parents:
diff changeset
3771 int masteryLvl = SkillToMastery(skillValue);
Ritor1
parents:
diff changeset
3772 switch (masteryLvl)
Ritor1
parents:
diff changeset
3773 {
Ritor1
parents:
diff changeset
3774 case 1: return mult1;
Ritor1
parents:
diff changeset
3775 case 2: return mult2;
Ritor1
parents:
diff changeset
3776 case 3: return mult3;
Ritor1
parents:
diff changeset
3777 case 4: return mult4;
Ritor1
parents:
diff changeset
3778 }
Ritor1
parents:
diff changeset
3779 Error("(%u)", masteryLvl);
Ritor1
parents:
diff changeset
3780 return 0;
Ritor1
parents:
diff changeset
3781 }
Ritor1
parents:
diff changeset
3782 //----- (00490109) --------------------------------------------------------
Ritor1
parents:
diff changeset
3783 // faces are: 0 1 2 3 human males
Ritor1
parents:
diff changeset
3784 // 4 5 6 7 human females
Ritor1
parents:
diff changeset
3785 // 8 9 elf males
Ritor1
parents:
diff changeset
3786 // 10 11 elf females
Ritor1
parents:
diff changeset
3787 // 12 13 dwarf males
Ritor1
parents:
diff changeset
3788 // 14 15 dwarf females
Ritor1
parents:
diff changeset
3789 // 16 17 goblin males
Ritor1
parents:
diff changeset
3790 // 18 19 goblin females
Ritor1
parents:
diff changeset
3791 // 20 lich male
Ritor1
parents:
diff changeset
3792 // 21 lich female
Ritor1
parents:
diff changeset
3793 // 22 underwater suits (unused)
Ritor1
parents:
diff changeset
3794 // 23 zombie male
Ritor1
parents:
diff changeset
3795 // 24 zombie female
Ritor1
parents:
diff changeset
3796 enum CHARACTER_RACE Player::GetRace()
Ritor1
parents:
diff changeset
3797 {
Ritor1
parents:
diff changeset
3798 if ( uCurrentFace <= 7 )
Ritor1
parents:
diff changeset
3799 {
Ritor1
parents:
diff changeset
3800 return CHARACTER_RACE_HUMAN;
Ritor1
parents:
diff changeset
3801 }
Ritor1
parents:
diff changeset
3802 else if ( uCurrentFace <= 11 )
Ritor1
parents:
diff changeset
3803 {
Ritor1
parents:
diff changeset
3804 return CHARACTER_RACE_ELF;
Ritor1
parents:
diff changeset
3805 }
Ritor1
parents:
diff changeset
3806 else if ( uCurrentFace <= 15 )
Ritor1
parents:
diff changeset
3807 {
Ritor1
parents:
diff changeset
3808 return CHARACTER_RACE_DWARF;
Ritor1
parents:
diff changeset
3809 }
Ritor1
parents:
diff changeset
3810 else if ( uCurrentFace <= 19 )
Ritor1
parents:
diff changeset
3811 {
Ritor1
parents:
diff changeset
3812 return CHARACTER_RACE_GOBLIN;
Ritor1
parents:
diff changeset
3813 }
Ritor1
parents:
diff changeset
3814 else
Ritor1
parents:
diff changeset
3815 {
Ritor1
parents:
diff changeset
3816 return CHARACTER_RACE_HUMAN;
Ritor1
parents:
diff changeset
3817 }
Ritor1
parents:
diff changeset
3818 }
Ritor1
parents:
diff changeset
3819
Ritor1
parents:
diff changeset
3820 //----- (00490141) --------------------------------------------------------
Ritor1
parents:
diff changeset
3821 PLAYER_SEX Player::GetSexByVoice()
Ritor1
parents:
diff changeset
3822 {
Ritor1
parents:
diff changeset
3823 switch ( this->uVoiceID )
Ritor1
parents:
diff changeset
3824 {
Ritor1
parents:
diff changeset
3825 case 0u:
Ritor1
parents:
diff changeset
3826 case 1u:
Ritor1
parents:
diff changeset
3827 case 2u:
Ritor1
parents:
diff changeset
3828 case 3u:
Ritor1
parents:
diff changeset
3829 case 8u:
Ritor1
parents:
diff changeset
3830 case 9u:
Ritor1
parents:
diff changeset
3831 case 0xCu:
Ritor1
parents:
diff changeset
3832 case 0xDu:
Ritor1
parents:
diff changeset
3833 case 0x10u:
Ritor1
parents:
diff changeset
3834 case 0x11u:
Ritor1
parents:
diff changeset
3835 case 0x14u:
Ritor1
parents:
diff changeset
3836 case 0x17u:
Ritor1
parents:
diff changeset
3837 return SEX_MALE;
Ritor1
parents:
diff changeset
3838
Ritor1
parents:
diff changeset
3839 case 4u:
Ritor1
parents:
diff changeset
3840 case 5u:
Ritor1
parents:
diff changeset
3841 case 6u:
Ritor1
parents:
diff changeset
3842 case 7u:
Ritor1
parents:
diff changeset
3843 case 0xAu:
Ritor1
parents:
diff changeset
3844 case 0xBu:
Ritor1
parents:
diff changeset
3845 case 0xEu:
Ritor1
parents:
diff changeset
3846 case 0xFu:
Ritor1
parents:
diff changeset
3847 case 0x12u:
Ritor1
parents:
diff changeset
3848 case 0x13u:
Ritor1
parents:
diff changeset
3849 case 0x15u:
Ritor1
parents:
diff changeset
3850 case 0x18u:
Ritor1
parents:
diff changeset
3851 return SEX_FEMALE;
Ritor1
parents:
diff changeset
3852 }
Ritor1
parents:
diff changeset
3853 Error("(%u)", this->uVoiceID);
Ritor1
parents:
diff changeset
3854 return SEX_MALE;
Ritor1
parents:
diff changeset
3855 }
Ritor1
parents:
diff changeset
3856
Ritor1
parents:
diff changeset
3857 //----- (00490188) --------------------------------------------------------
Ritor1
parents:
diff changeset
3858 void Player::SetInitialStats()
Ritor1
parents:
diff changeset
3859 {
Ritor1
parents:
diff changeset
3860 CHARACTER_RACE v1 = GetRace();
Ritor1
parents:
diff changeset
3861 uMight = StatTable[v1][0].uBaseValue;
Ritor1
parents:
diff changeset
3862 uIntelligence = StatTable[v1][1].uBaseValue;
Ritor1
parents:
diff changeset
3863 uWillpower = StatTable[v1][2].uBaseValue;
Ritor1
parents:
diff changeset
3864 uEndurance = StatTable[v1][3].uBaseValue;
Ritor1
parents:
diff changeset
3865 uAccuracy = StatTable[v1][4].uBaseValue;
Ritor1
parents:
diff changeset
3866 uSpeed = StatTable[v1][5].uBaseValue;
Ritor1
parents:
diff changeset
3867 uLuck = StatTable[v1][6].uBaseValue;
Ritor1
parents:
diff changeset
3868 }
Ritor1
parents:
diff changeset
3869
Ritor1
parents:
diff changeset
3870 //----- (004901FC) --------------------------------------------------------
Ritor1
parents:
diff changeset
3871 void Player::SetSexByVoice()
Ritor1
parents:
diff changeset
3872 {
Ritor1
parents:
diff changeset
3873 switch ( this->uVoiceID)
Ritor1
parents:
diff changeset
3874 {
Ritor1
parents:
diff changeset
3875 case 0:
Ritor1
parents:
diff changeset
3876 case 1:
Ritor1
parents:
diff changeset
3877 case 2:
Ritor1
parents:
diff changeset
3878 case 3:
Ritor1
parents:
diff changeset
3879 case 8:
Ritor1
parents:
diff changeset
3880 case 9:
Ritor1
parents:
diff changeset
3881 case 0xC:
Ritor1
parents:
diff changeset
3882 case 0xD:
Ritor1
parents:
diff changeset
3883 case 0x10:
Ritor1
parents:
diff changeset
3884 case 0x11:
Ritor1
parents:
diff changeset
3885 case 0x14:
Ritor1
parents:
diff changeset
3886 case 0x17:
Ritor1
parents:
diff changeset
3887 this->uSex = SEX_MALE;
Ritor1
parents:
diff changeset
3888 break;
Ritor1
parents:
diff changeset
3889 case 4:
Ritor1
parents:
diff changeset
3890 case 5:
Ritor1
parents:
diff changeset
3891 case 6:
Ritor1
parents:
diff changeset
3892 case 7:
Ritor1
parents:
diff changeset
3893 case 0xA:
Ritor1
parents:
diff changeset
3894 case 0xB:
Ritor1
parents:
diff changeset
3895 case 0xE:
Ritor1
parents:
diff changeset
3896 case 0xF:
Ritor1
parents:
diff changeset
3897 case 0x12:
Ritor1
parents:
diff changeset
3898 case 0x13:
Ritor1
parents:
diff changeset
3899 case 0x15:
Ritor1
parents:
diff changeset
3900 case 0x18:
Ritor1
parents:
diff changeset
3901 this->uSex = SEX_FEMALE;
Ritor1
parents:
diff changeset
3902 break;
Ritor1
parents:
diff changeset
3903 default:
Ritor1
parents:
diff changeset
3904 Error("(%u)", this->uVoiceID);
Ritor1
parents:
diff changeset
3905 break;
Ritor1
parents:
diff changeset
3906 }
Ritor1
parents:
diff changeset
3907
Ritor1
parents:
diff changeset
3908 }
Ritor1
parents:
diff changeset
3909
Ritor1
parents:
diff changeset
3910 //----- (0049024A) --------------------------------------------------------
Ritor1
parents:
diff changeset
3911 void Player::Reset(PLAYER_CLASS_TYPE cls)
Ritor1
parents:
diff changeset
3912 {
Ritor1
parents:
diff changeset
3913 sLevelModifier = 0;
Ritor1
parents:
diff changeset
3914 sAgeModifier = 0;
Ritor1
parents:
diff changeset
3915
Ritor1
parents:
diff changeset
3916 classType = cls;
Ritor1
parents:
diff changeset
3917 uLuckBonus = 0;
Ritor1
parents:
diff changeset
3918 uSpeedBonus = 0;
Ritor1
parents:
diff changeset
3919 uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
3920 uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
3921 uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
3922 uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
3923 uMightBonus = 0;
Ritor1
parents:
diff changeset
3924 uLevel = 1;
Ritor1
parents:
diff changeset
3925 uExperience = 251 + rand() % 100;
Ritor1
parents:
diff changeset
3926 uBirthYear = 1147 - rand() % 6;
Ritor1
parents:
diff changeset
3927 pActiveSkills.fill(0);
Ritor1
parents:
diff changeset
3928 memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits));
Ritor1
parents:
diff changeset
3929 memset(&spellbook, 0, sizeof(spellbook));
Ritor1
parents:
diff changeset
3930
Ritor1
parents:
diff changeset
3931 for (uint i = 0; i < 37; ++i)
Ritor1
parents:
diff changeset
3932 {
Ritor1
parents:
diff changeset
3933 if (pSkillAvailabilityPerClass[classType / 4][i] != 2)
Ritor1
parents:
diff changeset
3934 continue;
Ritor1
parents:
diff changeset
3935
Ritor1
parents:
diff changeset
3936 pActiveSkills[i] = 1;
Ritor1
parents:
diff changeset
3937
Ritor1
parents:
diff changeset
3938 switch (i)
Ritor1
parents:
diff changeset
3939 {
Ritor1
parents:
diff changeset
3940 case PLAYER_SKILL_FIRE:
Ritor1
parents:
diff changeset
3941 spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;//its temporary, for test spells
Ritor1
parents:
diff changeset
3942
Ritor1
parents:
diff changeset
3943 extern bool all_magic;
Ritor1
parents:
diff changeset
3944 if ( all_magic == true )
Ritor1
parents:
diff changeset
3945 {
Ritor1
parents:
diff changeset
3946 pActiveSkills[PLAYER_SKILL_AIR] = 1;
Ritor1
parents:
diff changeset
3947 pActiveSkills[PLAYER_SKILL_WATER] = 1;
Ritor1
parents:
diff changeset
3948 pActiveSkills[PLAYER_SKILL_EARTH] = 1;
Ritor1
parents:
diff changeset
3949 spellbook.pFireSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3950 spellbook.pFireSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3951 spellbook.pFireSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3952 spellbook.pFireSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3953 spellbook.pFireSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3954 spellbook.pFireSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3955 spellbook.pFireSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3956 spellbook.pFireSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3957 spellbook.pFireSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3958 spellbook.pFireSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3959 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3960 spellbook.pAirSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3961 spellbook.pAirSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3962 spellbook.pAirSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3963 spellbook.pAirSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3964 spellbook.pAirSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3965 spellbook.pAirSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3966 spellbook.pAirSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3967 spellbook.pAirSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3968 spellbook.pAirSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3969 spellbook.pAirSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3970 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3971 spellbook.pWaterSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3972 spellbook.pWaterSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3973 spellbook.pWaterSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3974 spellbook.pWaterSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3975 spellbook.pWaterSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3976 spellbook.pWaterSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3977 spellbook.pWaterSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3978 spellbook.pWaterSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3979 spellbook.pWaterSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3980 spellbook.pWaterSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3981 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3982 spellbook.pEarthSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
3983 spellbook.pEarthSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
3984 spellbook.pEarthSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
3985 spellbook.pEarthSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
3986 spellbook.pEarthSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
3987 spellbook.pEarthSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
3988 spellbook.pEarthSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
3989 spellbook.pEarthSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
3990 spellbook.pEarthSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
3991 spellbook.pEarthSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
3992 }
Ritor1
parents:
diff changeset
3993 break;
Ritor1
parents:
diff changeset
3994 case PLAYER_SKILL_AIR:
Ritor1
parents:
diff changeset
3995 spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3996 break;
Ritor1
parents:
diff changeset
3997 case PLAYER_SKILL_WATER:
Ritor1
parents:
diff changeset
3998 spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
3999 break;
Ritor1
parents:
diff changeset
4000 case PLAYER_SKILL_EARTH:
Ritor1
parents:
diff changeset
4001 spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4002 break;
Ritor1
parents:
diff changeset
4003 case PLAYER_SKILL_SPIRIT:
Ritor1
parents:
diff changeset
4004 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4005 break;
Ritor1
parents:
diff changeset
4006 case PLAYER_SKILL_MIND:
Ritor1
parents:
diff changeset
4007 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4008 break;
Ritor1
parents:
diff changeset
4009 case PLAYER_SKILL_BODY:
Ritor1
parents:
diff changeset
4010 spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4011
Ritor1
parents:
diff changeset
4012 if ( all_magic == true )
Ritor1
parents:
diff changeset
4013 {
Ritor1
parents:
diff changeset
4014 pActiveSkills[PLAYER_SKILL_MIND] = 1;
Ritor1
parents:
diff changeset
4015 pActiveSkills[PLAYER_SKILL_SPIRIT] = 1;
Ritor1
parents:
diff changeset
4016 spellbook.pBodySpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
4017 spellbook.pBodySpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
4018 spellbook.pBodySpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
4019 spellbook.pBodySpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
4020 spellbook.pBodySpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
4021 spellbook.pBodySpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
4022 spellbook.pBodySpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
4023 spellbook.pBodySpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
4024 spellbook.pBodySpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
4025 spellbook.pBodySpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
4026 spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4027 spellbook.pMindSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
4028 spellbook.pMindSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
4029 spellbook.pMindSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
4030 spellbook.pMindSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
4031 spellbook.pMindSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
4032 spellbook.pMindSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
4033 spellbook.pMindSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
4034 spellbook.pMindSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
4035 spellbook.pMindSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
4036 spellbook.pMindSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
4037 spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4038 spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true;
Ritor1
parents:
diff changeset
4039 spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true;
Ritor1
parents:
diff changeset
4040 spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true;
Ritor1
parents:
diff changeset
4041 spellbook.pSpiritSpellbook.bIsSpellAvailable[4] = true;
Ritor1
parents:
diff changeset
4042 spellbook.pSpiritSpellbook.bIsSpellAvailable[5] = true;
Ritor1
parents:
diff changeset
4043 spellbook.pSpiritSpellbook.bIsSpellAvailable[6] = true;
Ritor1
parents:
diff changeset
4044 spellbook.pSpiritSpellbook.bIsSpellAvailable[7] = true;
Ritor1
parents:
diff changeset
4045 spellbook.pSpiritSpellbook.bIsSpellAvailable[8] = true;
Ritor1
parents:
diff changeset
4046 spellbook.pSpiritSpellbook.bIsSpellAvailable[9] = true;
Ritor1
parents:
diff changeset
4047 spellbook.pSpiritSpellbook.bIsSpellAvailable[10] = true;
Ritor1
parents:
diff changeset
4048 }
Ritor1
parents:
diff changeset
4049 break;
Ritor1
parents:
diff changeset
4050 case PLAYER_SKILL_LIGHT:
Ritor1
parents:
diff changeset
4051 spellbook.pLightSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4052 break;
Ritor1
parents:
diff changeset
4053 case PLAYER_SKILL_DARK:
Ritor1
parents:
diff changeset
4054 spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true;
Ritor1
parents:
diff changeset
4055 break;
Ritor1
parents:
diff changeset
4056 }
Ritor1
parents:
diff changeset
4057 }
Ritor1
parents:
diff changeset
4058
Ritor1
parents:
diff changeset
4059 memset(&pEquipment, 0, sizeof(PlayerEquipment));
Ritor1
parents:
diff changeset
4060 pInventoryMatrix.fill(0);
Ritor1
parents:
diff changeset
4061 for (uint i = 0; i < 126; ++i)
Ritor1
parents:
diff changeset
4062 pInventoryItemList[i].Reset();
Ritor1
parents:
diff changeset
4063 for (uint i = 0; i < 12; ++i)
Ritor1
parents:
diff changeset
4064 pEquippedItems[i].Reset();
Ritor1
parents:
diff changeset
4065
Ritor1
parents:
diff changeset
4066 sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
4067 sMana = GetMaxMana();
Ritor1
parents:
diff changeset
4068 }
Ritor1
parents:
diff changeset
4069
Ritor1
parents:
diff changeset
4070 //----- (004903C9) --------------------------------------------------------
Ritor1
parents:
diff changeset
4071 PLAYER_SKILL_TYPE Player::GetSkillIdxByOrder(signed int order)
Ritor1
parents:
diff changeset
4072 {
Ritor1
parents:
diff changeset
4073 int counter; // edx@5
Ritor1
parents:
diff changeset
4074 bool canBeInactive;
Ritor1
parents:
diff changeset
4075 unsigned char requiredValue;
Ritor1
parents:
diff changeset
4076 signed int offset;
Ritor1
parents:
diff changeset
4077
Ritor1
parents:
diff changeset
4078 if ( order <= 1 )
Ritor1
parents:
diff changeset
4079 {
Ritor1
parents:
diff changeset
4080 canBeInactive = false;
Ritor1
parents:
diff changeset
4081 requiredValue = 2; // 2 - primary skill
Ritor1
parents:
diff changeset
4082 offset = 0;
Ritor1
parents:
diff changeset
4083 }
Ritor1
parents:
diff changeset
4084 else if ( order <= 3 )
Ritor1
parents:
diff changeset
4085 {
Ritor1
parents:
diff changeset
4086 canBeInactive = false;
Ritor1
parents:
diff changeset
4087 requiredValue = 1; // 1 - available
Ritor1
parents:
diff changeset
4088 offset = 2;
Ritor1
parents:
diff changeset
4089 }
Ritor1
parents:
diff changeset
4090 else if ( order <= 12 )
Ritor1
parents:
diff changeset
4091 {
Ritor1
parents:
diff changeset
4092 canBeInactive = true;
Ritor1
parents:
diff changeset
4093 requiredValue = 1; // 1 - available
Ritor1
parents:
diff changeset
4094 offset = 4;
Ritor1
parents:
diff changeset
4095 }
Ritor1
parents:
diff changeset
4096 else
Ritor1
parents:
diff changeset
4097 {
Ritor1
parents:
diff changeset
4098 return (PLAYER_SKILL_TYPE)37;
Ritor1
parents:
diff changeset
4099 }
Ritor1
parents:
diff changeset
4100 counter = 0;
Ritor1
parents:
diff changeset
4101 for (int i = 0; i < 37; i++)
Ritor1
parents:
diff changeset
4102 {
Ritor1
parents:
diff changeset
4103 if ( (this->pActiveSkills[i] || canBeInactive) && pSkillAvailabilityPerClass[classType / 4][i] == requiredValue )
Ritor1
parents:
diff changeset
4104 {
Ritor1
parents:
diff changeset
4105 if ( counter == order - offset )
Ritor1
parents:
diff changeset
4106 return (PLAYER_SKILL_TYPE)i;
Ritor1
parents:
diff changeset
4107 ++counter;
Ritor1
parents:
diff changeset
4108 }
Ritor1
parents:
diff changeset
4109 }
Ritor1
parents:
diff changeset
4110
Ritor1
parents:
diff changeset
4111 return (PLAYER_SKILL_TYPE)37;
Ritor1
parents:
diff changeset
4112 }
Ritor1
parents:
diff changeset
4113
Ritor1
parents:
diff changeset
4114
Ritor1
parents:
diff changeset
4115
Ritor1
parents:
diff changeset
4116 //----- (0049048D) --------------------------------------------------------
Ritor1
parents:
diff changeset
4117 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute)
Ritor1
parents:
diff changeset
4118 void Player::DecreaseAttribute(int eAttribute)
Ritor1
parents:
diff changeset
4119 {
Ritor1
parents:
diff changeset
4120 int pBaseValue; // ecx@1
Ritor1
parents:
diff changeset
4121 int pDroppedStep; // ebx@1
Ritor1
parents:
diff changeset
4122 int pStep; // esi@1
Ritor1
parents:
diff changeset
4123 int uMinValue; // [sp+Ch] [bp-4h]@1
Ritor1
parents:
diff changeset
4124
Ritor1
parents:
diff changeset
4125 int raceId = GetRace();
Ritor1
parents:
diff changeset
4126 pBaseValue = StatTable[raceId][eAttribute].uBaseValue;
Ritor1
parents:
diff changeset
4127 pDroppedStep = StatTable[raceId][eAttribute].uDroppedStep;
Ritor1
parents:
diff changeset
4128 uMinValue = pBaseValue - 2;
Ritor1
parents:
diff changeset
4129 pStep = StatTable[raceId][eAttribute].uBaseStep;
Ritor1
parents:
diff changeset
4130 unsigned short* AttrToChange = nullptr;
Ritor1
parents:
diff changeset
4131 switch ( eAttribute )
Ritor1
parents:
diff changeset
4132 {
Ritor1
parents:
diff changeset
4133 case CHARACTER_ATTRIBUTE_STRENGTH:
Ritor1
parents:
diff changeset
4134 AttrToChange = &this->uMight;
Ritor1
parents:
diff changeset
4135 break;
Ritor1
parents:
diff changeset
4136 case CHARACTER_ATTRIBUTE_INTELLIGENCE:
Ritor1
parents:
diff changeset
4137 AttrToChange = &this->uIntelligence;
Ritor1
parents:
diff changeset
4138 break;
Ritor1
parents:
diff changeset
4139 case CHARACTER_ATTRIBUTE_WILLPOWER:
Ritor1
parents:
diff changeset
4140 AttrToChange = &this->uWillpower;
Ritor1
parents:
diff changeset
4141 break;
Ritor1
parents:
diff changeset
4142 case CHARACTER_ATTRIBUTE_ENDURANCE:
Ritor1
parents:
diff changeset
4143 AttrToChange = &this->uEndurance;
Ritor1
parents:
diff changeset
4144 break;
Ritor1
parents:
diff changeset
4145 case CHARACTER_ATTRIBUTE_ACCURACY:
Ritor1
parents:
diff changeset
4146 AttrToChange = &this->uAccuracy;
Ritor1
parents:
diff changeset
4147 break;
Ritor1
parents:
diff changeset
4148 case CHARACTER_ATTRIBUTE_SPEED:
Ritor1
parents:
diff changeset
4149 AttrToChange = &this->uSpeed;
Ritor1
parents:
diff changeset
4150 break;
Ritor1
parents:
diff changeset
4151 case CHARACTER_ATTRIBUTE_LUCK:
Ritor1
parents:
diff changeset
4152 AttrToChange = &this->uLuck;
Ritor1
parents:
diff changeset
4153 break;
Ritor1
parents:
diff changeset
4154 }
Ritor1
parents:
diff changeset
4155 if ( *AttrToChange <= pBaseValue )
Ritor1
parents:
diff changeset
4156 pStep = pDroppedStep;
Ritor1
parents:
diff changeset
4157 if ( *AttrToChange - pStep >= uMinValue )
Ritor1
parents:
diff changeset
4158 *AttrToChange -= pStep;
Ritor1
parents:
diff changeset
4159 }
Ritor1
parents:
diff changeset
4160
Ritor1
parents:
diff changeset
4161 //----- (004905F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
4162 //signed int PartyCreation_BtnPlusClick(Player *this, int eAttribute)
Ritor1
parents:
diff changeset
4163 void Player::IncreaseAttribute( int eAttribute )
Ritor1
parents:
diff changeset
4164 {
Ritor1
parents:
diff changeset
4165 int raceId; // eax@1
Ritor1
parents:
diff changeset
4166 int maxValue; // ebx@1
Ritor1
parents:
diff changeset
4167 signed int baseStep; // edi@1
Ritor1
parents:
diff changeset
4168 signed int tmp; // eax@17
Ritor1
parents:
diff changeset
4169 signed int result; // eax@18
Ritor1
parents:
diff changeset
4170 int baseValue; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
4171 signed int droppedStep; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
4172 unsigned short* statToChange;
Ritor1
parents:
diff changeset
4173
Ritor1
parents:
diff changeset
4174 raceId = GetRace();
Ritor1
parents:
diff changeset
4175 maxValue = StatTable[raceId][eAttribute].uMaxValue;
Ritor1
parents:
diff changeset
4176 baseStep = StatTable[raceId][eAttribute].uBaseStep;
Ritor1
parents:
diff changeset
4177 baseValue = StatTable[raceId][eAttribute].uBaseValue;
Ritor1
parents:
diff changeset
4178 droppedStep = StatTable[raceId][eAttribute].uDroppedStep;
Ritor1
parents:
diff changeset
4179 PlayerCreation_GetUnspentAttributePointCount();
Ritor1
parents:
diff changeset
4180 switch ( eAttribute )
Ritor1
parents:
diff changeset
4181 {
Ritor1
parents:
diff changeset
4182 case 0:
Ritor1
parents:
diff changeset
4183 statToChange = &this->uMight;
Ritor1
parents:
diff changeset
4184 break;
Ritor1
parents:
diff changeset
4185 case 1:
Ritor1
parents:
diff changeset
4186 statToChange = &this->uIntelligence;
Ritor1
parents:
diff changeset
4187 break;
Ritor1
parents:
diff changeset
4188 case 2:
Ritor1
parents:
diff changeset
4189 statToChange = &this->uWillpower;
Ritor1
parents:
diff changeset
4190 break;
Ritor1
parents:
diff changeset
4191 case 3:
Ritor1
parents:
diff changeset
4192 statToChange = &this->uEndurance;
Ritor1
parents:
diff changeset
4193 break;
Ritor1
parents:
diff changeset
4194 case 4:
Ritor1
parents:
diff changeset
4195 statToChange = &this->uAccuracy;
Ritor1
parents:
diff changeset
4196 break;
Ritor1
parents:
diff changeset
4197 case 5:
Ritor1
parents:
diff changeset
4198 statToChange = &this->uSpeed;
Ritor1
parents:
diff changeset
4199 break;
Ritor1
parents:
diff changeset
4200 case 6:
Ritor1
parents:
diff changeset
4201 statToChange = &this->uLuck;
Ritor1
parents:
diff changeset
4202 break;
Ritor1
parents:
diff changeset
4203 default:
Ritor1
parents:
diff changeset
4204 Error("(%u)", eAttribute);
Ritor1
parents:
diff changeset
4205 break;
Ritor1
parents:
diff changeset
4206 }
Ritor1
parents:
diff changeset
4207 if ( *statToChange < baseValue )
Ritor1
parents:
diff changeset
4208 {
Ritor1
parents:
diff changeset
4209 tmp = baseStep;
Ritor1
parents:
diff changeset
4210 baseStep = droppedStep;
Ritor1
parents:
diff changeset
4211 droppedStep = tmp;
Ritor1
parents:
diff changeset
4212 }
Ritor1
parents:
diff changeset
4213 result = PlayerCreation_GetUnspentAttributePointCount();
Ritor1
parents:
diff changeset
4214 if ( result >= droppedStep )
Ritor1
parents:
diff changeset
4215 {
Ritor1
parents:
diff changeset
4216 if ( baseStep + *statToChange <= maxValue )
Ritor1
parents:
diff changeset
4217 *statToChange += baseStep;
Ritor1
parents:
diff changeset
4218 }
Ritor1
parents:
diff changeset
4219 }
Ritor1
parents:
diff changeset
4220
Ritor1
parents:
diff changeset
4221 //----- (0049070F) --------------------------------------------------------
Ritor1
parents:
diff changeset
4222 void Player::Zero()
Ritor1
parents:
diff changeset
4223 {
Ritor1
parents:
diff changeset
4224 this->sLevelModifier = 0;
Ritor1
parents:
diff changeset
4225 this->sACModifier = 0;
Ritor1
parents:
diff changeset
4226 this->uLuckBonus = 0;
Ritor1
parents:
diff changeset
4227 this->uAccuracyBonus = 0;
Ritor1
parents:
diff changeset
4228 this->uSpeedBonus = 0;
Ritor1
parents:
diff changeset
4229 this->uEnduranceBonus = 0;
Ritor1
parents:
diff changeset
4230 this->uWillpowerBonus = 0;
Ritor1
parents:
diff changeset
4231 this->uIntelligenceBonus = 0;
Ritor1
parents:
diff changeset
4232 this->uMightBonus = 0;
Ritor1
parents:
diff changeset
4233 this->field_100 = 0;
Ritor1
parents:
diff changeset
4234 this->field_FC = 0;
Ritor1
parents:
diff changeset
4235 this->field_F8 = 0;
Ritor1
parents:
diff changeset
4236 this->field_F4 = 0;
Ritor1
parents:
diff changeset
4237 this->field_F0 = 0;
Ritor1
parents:
diff changeset
4238 this->field_EC = 0;
Ritor1
parents:
diff changeset
4239 this->field_E8 = 0;
Ritor1
parents:
diff changeset
4240 this->field_E4 = 0;
Ritor1
parents:
diff changeset
4241 this->field_E0 = 0;
Ritor1
parents:
diff changeset
4242 memset(&this->sResFireBonus, 0, 0x16u);
Ritor1
parents:
diff changeset
4243 this->field_1A97 = 0;
Ritor1
parents:
diff changeset
4244 this->_ranged_dmg_bonus = 0;
Ritor1
parents:
diff changeset
4245 this->field_1A95 = 0;
Ritor1
parents:
diff changeset
4246 this->_ranged_atk_bonus = 0;
Ritor1
parents:
diff changeset
4247 this->field_1A93 = 0;
Ritor1
parents:
diff changeset
4248 this->_melee_dmg_bonus = 0;
Ritor1
parents:
diff changeset
4249 this->field_1A91 = 0;
Ritor1
parents:
diff changeset
4250 this->_some_attack_bonus = 0;
Ritor1
parents:
diff changeset
4251 this->_mana_related = 0;
Ritor1
parents:
diff changeset
4252 this->uFullManaBonus = 0;
Ritor1
parents:
diff changeset
4253 this->_health_related = 0;
Ritor1
parents:
diff changeset
4254 this->uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
4255 }
Ritor1
parents:
diff changeset
4256
Ritor1
parents:
diff changeset
4257 //----- (004907E7) --------------------------------------------------------
Ritor1
parents:
diff changeset
4258 unsigned int Player::GetStatColor(int uStat)
Ritor1
parents:
diff changeset
4259 {
Ritor1
parents:
diff changeset
4260 int attribute_value; // edx@1
Ritor1
parents:
diff changeset
4261
Ritor1
parents:
diff changeset
4262 int base_attribute_value = StatTable[GetRace()][uStat].uBaseValue;
Ritor1
parents:
diff changeset
4263 switch (uStat)
Ritor1
parents:
diff changeset
4264 {
Ritor1
parents:
diff changeset
4265 case 0: attribute_value = uMight; break;
Ritor1
parents:
diff changeset
4266 case 1: attribute_value = uIntelligence; break;
Ritor1
parents:
diff changeset
4267 case 2: attribute_value = uWillpower; break;
Ritor1
parents:
diff changeset
4268 case 3: attribute_value = uEndurance; break;
Ritor1
parents:
diff changeset
4269 case 4: attribute_value = uAccuracy; break;
Ritor1
parents:
diff changeset
4270 case 5: attribute_value = uSpeed; break;
Ritor1
parents:
diff changeset
4271 case 6: attribute_value = uLuck; break;
Ritor1
parents:
diff changeset
4272 default: Error("Unexpected attribute");
Ritor1
parents:
diff changeset
4273 };
Ritor1
parents:
diff changeset
4274
Ritor1
parents:
diff changeset
4275 if (attribute_value == base_attribute_value)
Ritor1
parents:
diff changeset
4276 return ui_character_stat_default_color;
Ritor1
parents:
diff changeset
4277 else if (attribute_value > base_attribute_value)
Ritor1
parents:
diff changeset
4278 return ui_character_stat_buffed_color;
Ritor1
parents:
diff changeset
4279 else
Ritor1
parents:
diff changeset
4280 return ui_character_stat_debuffed_color;
Ritor1
parents:
diff changeset
4281 }
Ritor1
parents:
diff changeset
4282
Ritor1
parents:
diff changeset
4283 //----- (004908A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
4284 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, signed __int64 uTime)
Ritor1
parents:
diff changeset
4285 {
Ritor1
parents:
diff changeset
4286 if ( pConditions[uCondition] && (uTime < (signed long long)pConditions[uCondition]) )
Ritor1
parents:
diff changeset
4287 {
Ritor1
parents:
diff changeset
4288 pConditions[uCondition] = 0i64;
Ritor1
parents:
diff changeset
4289 return true;
Ritor1
parents:
diff changeset
4290 }
Ritor1
parents:
diff changeset
4291 else
Ritor1
parents:
diff changeset
4292 return false;
Ritor1
parents:
diff changeset
4293 }
Ritor1
parents:
diff changeset
4294
Ritor1
parents:
diff changeset
4295 //----- (004680ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
4296 void Player::UseItem_DrinkPotion_etc(signed int player_num, int a3)
Ritor1
parents:
diff changeset
4297 {
Ritor1
parents:
diff changeset
4298 Player *playerAffected; // esi@1
Ritor1
parents:
diff changeset
4299 signed int v5; // eax@17
Ritor1
parents:
diff changeset
4300 int v8; // edx@39
Ritor1
parents:
diff changeset
4301 const char *v13; // eax@45
Ritor1
parents:
diff changeset
4302 signed int v15; // edi@68
Ritor1
parents:
diff changeset
4303 int v16; // edx@73
Ritor1
parents:
diff changeset
4304 unsigned __int16 v17; // edi@73
Ritor1
parents:
diff changeset
4305 unsigned int v18; // eax@73
Ritor1
parents:
diff changeset
4306 const char *v22; // eax@84
Ritor1
parents:
diff changeset
4307 int scroll_id; // esi@96
Ritor1
parents:
diff changeset
4308 int v25; // eax@109
Ritor1
parents:
diff changeset
4309 int v26; // eax@113
Ritor1
parents:
diff changeset
4310 int new_mana_val; // edi@114
Ritor1
parents:
diff changeset
4311 signed __int64 v28; // qax@120
Ritor1
parents:
diff changeset
4312 __int64 v30; // edi@137
Ritor1
parents:
diff changeset
4313 __int64 v32; // ST3C_4@137
Ritor1
parents:
diff changeset
4314 __int64 v34; // ST34_4@137
Ritor1
parents:
diff changeset
4315 unsigned __int16 v50; // [sp-Ch] [bp-38h]@120
Ritor1
parents:
diff changeset
4316 const char *v66; // [sp-4h] [bp-30h]@69
Ritor1
parents:
diff changeset
4317 signed int v67; // [sp-4h] [bp-30h]@77
Ritor1
parents:
diff changeset
4318 const char *v68; // [sp-4h] [bp-30h]@89
Ritor1
parents:
diff changeset
4319 char v72; // [sp+20h] [bp-Ch]@68
Ritor1
parents:
diff changeset
4320 signed int v73; // [sp+24h] [bp-8h]@1
Ritor1
parents:
diff changeset
4321 const char* v74; // [sp+24h] [bp-8h]@23
Ritor1
parents:
diff changeset
4322 //Player *thisb; // [sp+28h] [bp-4h]@1
Ritor1
parents:
diff changeset
4323 unsigned int thisa; // [sp+28h] [bp-4h]@22
Ritor1
parents:
diff changeset
4324
Ritor1
parents:
diff changeset
4325 //thisb = this;
Ritor1
parents:
diff changeset
4326 playerAffected = &pParty->pPlayers[player_num-1];
Ritor1
parents:
diff changeset
4327 v73 = 1;
Ritor1
parents:
diff changeset
4328 if ( pParty->bTurnBasedModeOn == true && (pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT) )
Ritor1
parents:
diff changeset
4329 return;
Ritor1
parents:
diff changeset
4330 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_REAGENT )
Ritor1
parents:
diff changeset
4331 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4332 if (pParty->pPickedItem.uItemID == ITEM_161)
2498
Ritor1
parents:
diff changeset
4333 {
Ritor1
parents:
diff changeset
4334 playerAffected->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
4335 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4336 else if (pParty->pPickedItem.uItemID == ITEM_161)
2498
Ritor1
parents:
diff changeset
4337 {
Ritor1
parents:
diff changeset
4338 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4339 new_mana_val += 2;
Ritor1
parents:
diff changeset
4340 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4341 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4342 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4343 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4344 else if (pParty->pPickedItem.uItemID == ITEM_162)
2498
Ritor1
parents:
diff changeset
4345 {
Ritor1
parents:
diff changeset
4346 playerAffected->Heal(2);
Ritor1
parents:
diff changeset
4347 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4348 }
Ritor1
parents:
diff changeset
4349 else
Ritor1
parents:
diff changeset
4350 {
Ritor1
parents:
diff changeset
4351 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4352 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
Ritor1
parents:
diff changeset
4353 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4354 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4355 return;
Ritor1
parents:
diff changeset
4356 }
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4357 pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4358
Ritor1
parents:
diff changeset
4359 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4360 {
Ritor1
parents:
diff changeset
4361 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4362 }
Ritor1
parents:
diff changeset
4363 if ( v73 )
Ritor1
parents:
diff changeset
4364 {
Ritor1
parents:
diff changeset
4365 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4366 {
Ritor1
parents:
diff changeset
4367 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4368 this->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4369 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4370 }
Ritor1
parents:
diff changeset
4371 else
Ritor1
parents:
diff changeset
4372 {
Ritor1
parents:
diff changeset
4373 this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
Ritor1
parents:
diff changeset
4374 }
Ritor1
parents:
diff changeset
4375 }
Ritor1
parents:
diff changeset
4376 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4377 return;
Ritor1
parents:
diff changeset
4378 }
Ritor1
parents:
diff changeset
4379
Ritor1
parents:
diff changeset
4380 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_POTION )
Ritor1
parents:
diff changeset
4381 {
Ritor1
parents:
diff changeset
4382 switch ( pParty->pPickedItem.uItemID )
Ritor1
parents:
diff changeset
4383 {
Ritor1
parents:
diff changeset
4384 case 221: //Catalyst
Ritor1
parents:
diff changeset
4385 playerAffected->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
4386 break;
Ritor1
parents:
diff changeset
4387 case 222: //Cure Wounds
Ritor1
parents:
diff changeset
4388 v25 = pParty->pPickedItem.uEnchantmentType + 10;
Ritor1
parents:
diff changeset
4389 playerAffected->Heal(v25);
Ritor1
parents:
diff changeset
4390 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4391 break;
Ritor1
parents:
diff changeset
4392 case 223: //Magic Potion
Ritor1
parents:
diff changeset
4393 v26 = pParty->pPickedItem.uEnchantmentType + 10;
Ritor1
parents:
diff changeset
4394 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4395 new_mana_val += v26;
Ritor1
parents:
diff changeset
4396 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4397 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4398 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4399 playerAffected->sMana = new_mana_val;
Ritor1
parents:
diff changeset
4400 break;
Ritor1
parents:
diff changeset
4401 case 224: //Cure Weakness
Ritor1
parents:
diff changeset
4402 playerAffected->pConditions[Condition_Weak] = 0i64;
Ritor1
parents:
diff changeset
4403 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4404 break;
Ritor1
parents:
diff changeset
4405 case 225: //Cure Disease
Ritor1
parents:
diff changeset
4406 playerAffected->pConditions[Condition_Disease_Severe] = 0i64;
Ritor1
parents:
diff changeset
4407 playerAffected->pConditions[Condition_Disease_Medium] = 0i64;
Ritor1
parents:
diff changeset
4408 playerAffected->pConditions[Condition_Disease_Weak] = 0i64;
Ritor1
parents:
diff changeset
4409 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4410 break;
Ritor1
parents:
diff changeset
4411 case 226: //Cure Poison
Ritor1
parents:
diff changeset
4412 playerAffected->pConditions[Condition_Poison_Severe] = 0i64;
Ritor1
parents:
diff changeset
4413 playerAffected->pConditions[Condition_Poison_Medium] = 0i64;
Ritor1
parents:
diff changeset
4414 playerAffected->pConditions[Condition_Poison_Weak] = 0i64;
Ritor1
parents:
diff changeset
4415 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4416 break;
Ritor1
parents:
diff changeset
4417 case 227: //Awaken
Ritor1
parents:
diff changeset
4418 playerAffected->pConditions[Condition_Sleep] = 0i64;
Ritor1
parents:
diff changeset
4419 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4420 break;
Ritor1
parents:
diff changeset
4421 case 228: //Haste
Ritor1
parents:
diff changeset
4422 if ( !playerAffected->pConditions[Condition_Weak] )
Ritor1
parents:
diff changeset
4423 {
Ritor1
parents:
diff changeset
4424 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4425 playerAffected->pPlayerBuffs[PLAYER_BUFF_HASTE].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4426 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4427 }
Ritor1
parents:
diff changeset
4428 break;
Ritor1
parents:
diff changeset
4429 case 229: //Heroism
Ritor1
parents:
diff changeset
4430 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4431 playerAffected->pPlayerBuffs[PLAYER_BUFF_HEROISM].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4432 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4433 break;
Ritor1
parents:
diff changeset
4434 case 230: //Bless
Ritor1
parents:
diff changeset
4435 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4436 playerAffected->pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4437 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4438 break;
Ritor1
parents:
diff changeset
4439 case 231: //Preservation
Ritor1
parents:
diff changeset
4440 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4441 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4442 playerAffected->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4443 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4444 break;
Ritor1
parents:
diff changeset
4445 case 232: //Shield
Ritor1
parents:
diff changeset
4446 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4447 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4448 playerAffected->pPlayerBuffs[PLAYER_BUFF_SHIELD].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4449 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4450 break;
Ritor1
parents:
diff changeset
4451 case 234: //Stoneskin
Ritor1
parents:
diff changeset
4452 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4453 playerAffected->pPlayerBuffs[PLAYER_BUFF_STONESKIN].Apply(pParty->uTimePlayed + v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4454 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4455 break;
Ritor1
parents:
diff changeset
4456 case 235: //Water Breathing
Ritor1
parents:
diff changeset
4457 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335),
Ritor1
parents:
diff changeset
4458 playerAffected->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].Apply(pParty->uTimePlayed +v28, 3, 5, 0, 0);
Ritor1
parents:
diff changeset
4459 break;
Ritor1
parents:
diff changeset
4460 case 237: //Remove Fear
Ritor1
parents:
diff changeset
4461 playerAffected->pConditions[Condition_Fear] = 0i64;
Ritor1
parents:
diff changeset
4462 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4463 break;
Ritor1
parents:
diff changeset
4464 case 238: //Remove Curse
Ritor1
parents:
diff changeset
4465 playerAffected->pConditions[Condition_Cursed] = 0i64;
Ritor1
parents:
diff changeset
4466 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4467 break;
Ritor1
parents:
diff changeset
4468 case 239: //Cure Insanity
Ritor1
parents:
diff changeset
4469 playerAffected->pConditions[Condition_Insane] = 0i64;
Ritor1
parents:
diff changeset
4470 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4471 break;
Ritor1
parents:
diff changeset
4472 case 240: //Might Boost
Ritor1
parents:
diff changeset
4473 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4474 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4475 playerAffected->pPlayerBuffs[PLAYER_BUFF_STRENGTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4476 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4477 break;
Ritor1
parents:
diff changeset
4478 case 241: //Intellect Boost
Ritor1
parents:
diff changeset
4479 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4480 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4481 playerAffected->pPlayerBuffs[PLAYER_BUFF_INTELLIGENCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4482 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4483 break;
Ritor1
parents:
diff changeset
4484 case 242: //Personality Boost
Ritor1
parents:
diff changeset
4485 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4486 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4487 playerAffected->pPlayerBuffs[PLAYER_BUFF_WILLPOWER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4488 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4489 break;
Ritor1
parents:
diff changeset
4490 case 243://Endurance Boost
Ritor1
parents:
diff changeset
4491 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4492 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4493 playerAffected->pPlayerBuffs[PLAYER_BUFF_ENDURANCE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4494 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4495 break;
Ritor1
parents:
diff changeset
4496 case 244: //Speed Boost
Ritor1
parents:
diff changeset
4497 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4498 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4499 playerAffected->pPlayerBuffs[PLAYER_BUFF_SPEED].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4500 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4501 break;
Ritor1
parents:
diff changeset
4502 case 245: //Accuracy Boost
Ritor1
parents:
diff changeset
4503 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4504 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4505 playerAffected->pPlayerBuffs[PLAYER_BUFF_ACCURACY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4506 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4507 break;
Ritor1
parents:
diff changeset
4508 case 251: //Cure Paralysis
Ritor1
parents:
diff changeset
4509 playerAffected->pConditions[Condition_Paralyzed] = 0i64;
Ritor1
parents:
diff changeset
4510 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4511 break;
Ritor1
parents:
diff changeset
4512 case 252://Divine Restoration
Ritor1
parents:
diff changeset
4513 v30 = playerAffected->pConditions[Condition_Dead];
Ritor1
parents:
diff changeset
4514 v32 = playerAffected->pConditions[Condition_Pertified];
Ritor1
parents:
diff changeset
4515 v34 = playerAffected->pConditions[Condition_Eradicated];
Ritor1
parents:
diff changeset
4516 pConditions.fill(0);
Ritor1
parents:
diff changeset
4517 playerAffected->pConditions[Condition_Dead] = v30;
Ritor1
parents:
diff changeset
4518 playerAffected->pConditions[Condition_Pertified] = v32;
Ritor1
parents:
diff changeset
4519 playerAffected->pConditions[Condition_Eradicated] = v34;
Ritor1
parents:
diff changeset
4520 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4521 break;
Ritor1
parents:
diff changeset
4522 case 253: //Divine Cure
Ritor1
parents:
diff changeset
4523 v25 = 5 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4524 playerAffected->Heal(v25);
Ritor1
parents:
diff changeset
4525 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4526 break;
Ritor1
parents:
diff changeset
4527 case 254: //Divine Power
Ritor1
parents:
diff changeset
4528 v26 = 5 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4529 new_mana_val = playerAffected->sMana;
Ritor1
parents:
diff changeset
4530 new_mana_val += v26;
Ritor1
parents:
diff changeset
4531 if ( new_mana_val > playerAffected->GetMaxMana() )
Ritor1
parents:
diff changeset
4532 new_mana_val = playerAffected->GetMaxMana();
Ritor1
parents:
diff changeset
4533 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4534 break;
Ritor1
parents:
diff changeset
4535 case 255: //Luck Boost
Ritor1
parents:
diff changeset
4536 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4537 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4538 playerAffected->pPlayerBuffs[PLAYER_BUFF_LUCK].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4539 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4540 break;
Ritor1
parents:
diff changeset
4541 case 256: //Fire Resistance
Ritor1
parents:
diff changeset
4542 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4543 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4544 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4545 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4546 break;
Ritor1
parents:
diff changeset
4547 case 257: //Air Resistance
Ritor1
parents:
diff changeset
4548 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4549 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4550 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4551 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4552 break;
Ritor1
parents:
diff changeset
4553 case 258: //Water Resistance
Ritor1
parents:
diff changeset
4554 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4555 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4556 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4557 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4558 break;
Ritor1
parents:
diff changeset
4559 case 259: //Earth Resistance
Ritor1
parents:
diff changeset
4560 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4561 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4562 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4563 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4564 break;
Ritor1
parents:
diff changeset
4565 case 260: //Mind Resistance
Ritor1
parents:
diff changeset
4566 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4567 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4568 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4569 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4570 break;
Ritor1
parents:
diff changeset
4571 case 261: //Body Resistance
Ritor1
parents:
diff changeset
4572 v50 = 3 * pParty->pPickedItem.uEnchantmentType;
Ritor1
parents:
diff changeset
4573 v28 = (signed __int64)((double)(230400 * pParty->pPickedItem.uEnchantmentType) * 0.033333335);
Ritor1
parents:
diff changeset
4574 playerAffected->pPlayerBuffs[PLAYER_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + v28, 0, v50, 0, 0);
Ritor1
parents:
diff changeset
4575 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4576 break;
Ritor1
parents:
diff changeset
4577 case 262: //Stone to Flesh
Ritor1
parents:
diff changeset
4578 playerAffected->pConditions[Condition_Pertified] = 0i64;
Ritor1
parents:
diff changeset
4579 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4580 break;
Ritor1
parents:
diff changeset
4581 case 264: //Pure Luck
Ritor1
parents:
diff changeset
4582 if ( !playerAffected->pure_luck_used )
Ritor1
parents:
diff changeset
4583 {
Ritor1
parents:
diff changeset
4584 playerAffected->uLuck += 50;
Ritor1
parents:
diff changeset
4585 playerAffected->pure_luck_used = 1;
Ritor1
parents:
diff changeset
4586 }
Ritor1
parents:
diff changeset
4587 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4588 break;
Ritor1
parents:
diff changeset
4589 case 265: //Pure Speed
Ritor1
parents:
diff changeset
4590 if ( !playerAffected->pure_speed_used )
Ritor1
parents:
diff changeset
4591 {
Ritor1
parents:
diff changeset
4592 playerAffected->uSpeed += 50;
Ritor1
parents:
diff changeset
4593 playerAffected->pure_speed_used = 1;
Ritor1
parents:
diff changeset
4594 }
Ritor1
parents:
diff changeset
4595 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4596 break;
Ritor1
parents:
diff changeset
4597 case 266: //Pure Intellect
Ritor1
parents:
diff changeset
4598 if ( !playerAffected->pure_intellect_used )
Ritor1
parents:
diff changeset
4599 {
Ritor1
parents:
diff changeset
4600 playerAffected->uIntelligence += 50;
Ritor1
parents:
diff changeset
4601 playerAffected->pure_intellect_used = 1;
Ritor1
parents:
diff changeset
4602 }
Ritor1
parents:
diff changeset
4603 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4604 break;
Ritor1
parents:
diff changeset
4605 case 267: //Pure Endurance
Ritor1
parents:
diff changeset
4606 if ( !playerAffected->pure_endurance_used )
Ritor1
parents:
diff changeset
4607 {
Ritor1
parents:
diff changeset
4608 playerAffected->uEndurance += 50;
Ritor1
parents:
diff changeset
4609 playerAffected->pure_endurance_used = 1;
Ritor1
parents:
diff changeset
4610 }
Ritor1
parents:
diff changeset
4611 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4612 break;
Ritor1
parents:
diff changeset
4613 case 268: //Pure Personality
Ritor1
parents:
diff changeset
4614 if ( !playerAffected->pure_willpower_used )
Ritor1
parents:
diff changeset
4615 {
Ritor1
parents:
diff changeset
4616 playerAffected->uWillpower += 50;
Ritor1
parents:
diff changeset
4617 playerAffected->pure_willpower_used = 1;
Ritor1
parents:
diff changeset
4618 }
Ritor1
parents:
diff changeset
4619 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4620 break;
Ritor1
parents:
diff changeset
4621 case 269: //Pure Accuracy
Ritor1
parents:
diff changeset
4622 if ( !playerAffected->pure_accuracy_used )
Ritor1
parents:
diff changeset
4623 {
Ritor1
parents:
diff changeset
4624 playerAffected->uAccuracy += 50;
Ritor1
parents:
diff changeset
4625 playerAffected->pure_accuracy_used = 1;
Ritor1
parents:
diff changeset
4626 }
Ritor1
parents:
diff changeset
4627 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4628 break;
Ritor1
parents:
diff changeset
4629 case 270: //Pure Might
Ritor1
parents:
diff changeset
4630 if ( !playerAffected->pure_might_used )
Ritor1
parents:
diff changeset
4631 {
Ritor1
parents:
diff changeset
4632 playerAffected->uMight += 50;
Ritor1
parents:
diff changeset
4633 playerAffected->pure_might_used = 1;
Ritor1
parents:
diff changeset
4634 }
Ritor1
parents:
diff changeset
4635 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4636 break;
Ritor1
parents:
diff changeset
4637 case 271: //Rejuvenation
Ritor1
parents:
diff changeset
4638 playerAffected->sAgeModifier = 0;
Ritor1
parents:
diff changeset
4639 playerAffected->PlaySound(SPEECH_36, 0);
Ritor1
parents:
diff changeset
4640 break;
Ritor1
parents:
diff changeset
4641
Ritor1
parents:
diff changeset
4642 default:
Ritor1
parents:
diff changeset
4643 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4644 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4645 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4646 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4647 return;
Ritor1
parents:
diff changeset
4648 }
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4649 pAudioPlayer->PlaySound(SOUND_drink, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4650 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4651 {
Ritor1
parents:
diff changeset
4652 // if ( !v73 ) v73 is always 1 at this point
Ritor1
parents:
diff changeset
4653 // {
Ritor1
parents:
diff changeset
4654 // pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4655 // return;
Ritor1
parents:
diff changeset
4656 // }
Ritor1
parents:
diff changeset
4657 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4658 }
Ritor1
parents:
diff changeset
4659 if ( v73 )
Ritor1
parents:
diff changeset
4660 {
Ritor1
parents:
diff changeset
4661 if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4662 {
Ritor1
parents:
diff changeset
4663 pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4664 this->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4665 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4666 }
Ritor1
parents:
diff changeset
4667 else
Ritor1
parents:
diff changeset
4668 {
Ritor1
parents:
diff changeset
4669 this->SetRecoveryTime((int)(flt_6BE3A4_debug_recmod1 * 213.3333333333333));
Ritor1
parents:
diff changeset
4670 }
Ritor1
parents:
diff changeset
4671 }
Ritor1
parents:
diff changeset
4672 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4673 return;
Ritor1
parents:
diff changeset
4674 }
Ritor1
parents:
diff changeset
4675
Ritor1
parents:
diff changeset
4676
Ritor1
parents:
diff changeset
4677 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_SPELL_SCROLL )
Ritor1
parents:
diff changeset
4678 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4679 if ( current_screen_type == SCREEN_CASTING )
2498
Ritor1
parents:
diff changeset
4680 return;
Ritor1
parents:
diff changeset
4681 if ( !playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4682 {
Ritor1
parents:
diff changeset
4683
Ritor1
parents:
diff changeset
4684 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4685 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4686 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4687 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4688 return;
Ritor1
parents:
diff changeset
4689 }
Ritor1
parents:
diff changeset
4690 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
4691 {
Ritor1
parents:
diff changeset
4692 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2u);//"You can not do that while you are underwater!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4693 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4694 return;
Ritor1
parents:
diff changeset
4695 }
Ritor1
parents:
diff changeset
4696
Ritor1
parents:
diff changeset
4697 scroll_id = pParty->pPickedItem.uItemID - 299;
Ritor1
parents:
diff changeset
4698 if ( scroll_id == 30 || scroll_id == 4 || scroll_id == 91 || scroll_id == 28 ) //Enchant Item scroll, Vampiric Weapon scroll ,Recharge Item ,Fire Aura
Ritor1
parents:
diff changeset
4699 {
Ritor1
parents:
diff changeset
4700 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4701 pGUIWindow_CurrentMenu->Release();
Ritor1
parents:
diff changeset
4702 pIcons_LOD->RemoveTexturesPackFromTextureList();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4703 current_screen_type = SCREEN_GAME;
2498
Ritor1
parents:
diff changeset
4704 viewparams->bRedrawGameUI = 1;
2566
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2556
diff changeset
4705 _42777D_CastSpell_UseWand_ShootArrow((SPELL_TYPE)scroll_id, player_num - 1, 0x85u, 1, 0);
2498
Ritor1
parents:
diff changeset
4706 }
Ritor1
parents:
diff changeset
4707 else
Ritor1
parents:
diff changeset
4708 {
Ritor1
parents:
diff changeset
4709 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4710 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
2543
b6140dfeac27 GameOver h/cpp
a.parshin
parents: 2541
diff changeset
4711 if (current_screen_type != SCREEN_GAME && pGUIWindow_CurrentMenu
2498
Ritor1
parents:
diff changeset
4712 && (pGUIWindow_CurrentMenu->eWindowType != WINDOW_null))
Ritor1
parents:
diff changeset
4713 {
Ritor1
parents:
diff changeset
4714 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4715 }
Ritor1
parents:
diff changeset
4716 }
Ritor1
parents:
diff changeset
4717 return;
Ritor1
parents:
diff changeset
4718 }
Ritor1
parents:
diff changeset
4719
Ritor1
parents:
diff changeset
4720 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_BOOK )
Ritor1
parents:
diff changeset
4721 {
Ritor1
parents:
diff changeset
4722 v15 = pParty->pPickedItem.uItemID - 400;
Ritor1
parents:
diff changeset
4723 v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2;
Ritor1
parents:
diff changeset
4724 if ( v72 )
Ritor1
parents:
diff changeset
4725 {
Ritor1
parents:
diff changeset
4726 v66 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4727 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4728 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4729 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4730 return;
Ritor1
parents:
diff changeset
4731 }
Ritor1
parents:
diff changeset
4732 if ( !playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4733 {
Ritor1
parents:
diff changeset
4734 v66 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4735 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
Ritor1
parents:
diff changeset
4736 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4737 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4738 return;
Ritor1
parents:
diff changeset
4739 }
Ritor1
parents:
diff changeset
4740 v16 = v15 % 11 + 1;
Ritor1
parents:
diff changeset
4741 v17 = playerAffected->pActiveSkills[v15 / 11 + 12];
Ritor1
parents:
diff changeset
4742 v18 = SkillToMastery(v17) - 1;
Ritor1
parents:
diff changeset
4743 switch (v18)
Ritor1
parents:
diff changeset
4744 {
Ritor1
parents:
diff changeset
4745 case 0: v67 = 4; break;
Ritor1
parents:
diff changeset
4746 case 1: v67 = 7; break;
Ritor1
parents:
diff changeset
4747 case 2: v67 = 10; break;
Ritor1
parents:
diff changeset
4748 case 3: v67 = 11; break;
Ritor1
parents:
diff changeset
4749 default:
Ritor1
parents:
diff changeset
4750 v67 = player_num;
Ritor1
parents:
diff changeset
4751 }
Ritor1
parents:
diff changeset
4752
Ritor1
parents:
diff changeset
4753 if ( v16 > v67 || !v17 )
Ritor1
parents:
diff changeset
4754 {
Ritor1
parents:
diff changeset
4755 v22 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4756 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
Ritor1
parents:
diff changeset
4757 ShowStatusBarString(pTmpBuf.data(), 2);
Ritor1
parents:
diff changeset
4758 playerAffected->PlaySound((PlayerSpeech)20, 0);
Ritor1
parents:
diff changeset
4759 return;
Ritor1
parents:
diff changeset
4760 }
Ritor1
parents:
diff changeset
4761 playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400] = 1;
Ritor1
parents:
diff changeset
4762 playerAffected->PlaySound(SPEECH_21, 0);
Ritor1
parents:
diff changeset
4763 v73 = 0;
Ritor1
parents:
diff changeset
4764
Ritor1
parents:
diff changeset
4765
Ritor1
parents:
diff changeset
4766 if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
Ritor1
parents:
diff changeset
4767 {
Ritor1
parents:
diff changeset
4768 if ( !v73 )
Ritor1
parents:
diff changeset
4769 {
Ritor1
parents:
diff changeset
4770 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4771 return;
Ritor1
parents:
diff changeset
4772 }
Ritor1
parents:
diff changeset
4773 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
Ritor1
parents:
diff changeset
4774 }
Ritor1
parents:
diff changeset
4775 // if ( v73 ) v73 is always 0 at this point
Ritor1
parents:
diff changeset
4776 // {
Ritor1
parents:
diff changeset
4777 // if ( pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
4778 // {
Ritor1
parents:
diff changeset
4779 // pParty->pTurnBasedPlayerRecoveryTimes[player_num-1] = 100;
Ritor1
parents:
diff changeset
4780 // thisb->SetRecoveryTime(100);
Ritor1
parents:
diff changeset
4781 // pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
4782 // }
Ritor1
parents:
diff changeset
4783 // else
Ritor1
parents:
diff changeset
4784 // {
Ritor1
parents:
diff changeset
4785 // thisb->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * 213.3333333333333);
Ritor1
parents:
diff changeset
4786 // }
Ritor1
parents:
diff changeset
4787 // }
Ritor1
parents:
diff changeset
4788 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4789 return;
Ritor1
parents:
diff changeset
4790 }
Ritor1
parents:
diff changeset
4791
Ritor1
parents:
diff changeset
4792 if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_MESSAGE_SCROLL )
Ritor1
parents:
diff changeset
4793 {
Ritor1
parents:
diff changeset
4794 if ( playerAffected->CanAct() )
Ritor1
parents:
diff changeset
4795 {
Ritor1
parents:
diff changeset
4796 CreateMsgScrollWindow(pParty->pPickedItem.uItemID);
Ritor1
parents:
diff changeset
4797 playerAffected->PlaySound(SPEECH_37, 0);
Ritor1
parents:
diff changeset
4798 return;
Ritor1
parents:
diff changeset
4799 }
Ritor1
parents:
diff changeset
4800 v68 = aCharacterConditionNames[playerAffected->GetMajorConditionIdx()];
Ritor1
parents:
diff changeset
4801 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);//That player is %s
Ritor1
parents:
diff changeset
4802 ShowStatusBarString(pTmpBuf.data(), 2);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4803 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4804 return;
Ritor1
parents:
diff changeset
4805 }
Ritor1
parents:
diff changeset
4806 else
Ritor1
parents:
diff changeset
4807 {
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4808 if (pParty->pPickedItem.uItemID == ITEM_GENIE_LAMP)
2498
Ritor1
parents:
diff changeset
4809 {
Ritor1
parents:
diff changeset
4810 thisa = pParty->uCurrentMonthWeek + 1;
Ritor1
parents:
diff changeset
4811 if ( pParty->uCurrentMonth >= 7 )
Ritor1
parents:
diff changeset
4812 v74 = nullptr;
Ritor1
parents:
diff changeset
4813 else
Ritor1
parents:
diff changeset
4814 v74 = aAttributeNames[pParty->uCurrentMonth];
Ritor1
parents:
diff changeset
4815 switch ( pParty->uCurrentMonth )
Ritor1
parents:
diff changeset
4816 {
Ritor1
parents:
diff changeset
4817 case 0:
Ritor1
parents:
diff changeset
4818 playerAffected->uMight += thisa;
Ritor1
parents:
diff changeset
4819 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4820 break;
Ritor1
parents:
diff changeset
4821 case 1:
Ritor1
parents:
diff changeset
4822 playerAffected->uIntelligence += thisa;
Ritor1
parents:
diff changeset
4823 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4824 break;
Ritor1
parents:
diff changeset
4825 case 2:
Ritor1
parents:
diff changeset
4826 playerAffected->uWillpower += thisa;
Ritor1
parents:
diff changeset
4827 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4828 break;
Ritor1
parents:
diff changeset
4829 case 3:
Ritor1
parents:
diff changeset
4830 playerAffected->uEndurance += thisa;
Ritor1
parents:
diff changeset
4831 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4832 break;
Ritor1
parents:
diff changeset
4833 case 4:
Ritor1
parents:
diff changeset
4834 playerAffected->uAccuracy += thisa;
Ritor1
parents:
diff changeset
4835 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4836 break;
Ritor1
parents:
diff changeset
4837 case 5:
Ritor1
parents:
diff changeset
4838 playerAffected->uSpeed += thisa;
Ritor1
parents:
diff changeset
4839 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4840 break;
Ritor1
parents:
diff changeset
4841 case 6:
Ritor1
parents:
diff changeset
4842 playerAffected->uLuck += thisa;
Ritor1
parents:
diff changeset
4843 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"
Ritor1
parents:
diff changeset
4844 break;
Ritor1
parents:
diff changeset
4845 case 7:
Ritor1
parents:
diff changeset
4846 pParty->PartyFindsGold(1000 * thisa, 0);
Ritor1
parents:
diff changeset
4847 sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
Ritor1
parents:
diff changeset
4848 break;
Ritor1
parents:
diff changeset
4849 case 8:
Ritor1
parents:
diff changeset
4850 Party::GiveFood(5 * thisa);
Ritor1
parents:
diff changeset
4851 sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
Ritor1
parents:
diff changeset
4852 break;
Ritor1
parents:
diff changeset
4853 case 9u:
Ritor1
parents:
diff changeset
4854 playerAffected->uSkillPoints += 2 * thisa;
Ritor1
parents:
diff changeset
4855 sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
Ritor1
parents:
diff changeset
4856 break;
Ritor1
parents:
diff changeset
4857 case 10:
Ritor1
parents:
diff changeset
4858 playerAffected->uExperience += 2500 * thisa;
Ritor1
parents:
diff changeset
4859 sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
Ritor1
parents:
diff changeset
4860 break;
Ritor1
parents:
diff changeset
4861 case 11:
Ritor1
parents:
diff changeset
4862 v8 = rand() % 6;
Ritor1
parents:
diff changeset
4863 switch (v8)
Ritor1
parents:
diff changeset
4864 {
Ritor1
parents:
diff changeset
4865 case 0:
Ritor1
parents:
diff changeset
4866 playerAffected->sResFireBase += thisa;
Ritor1
parents:
diff changeset
4867 v13 = pGlobalTXT_LocalizationStrings[87];//Fire
Ritor1
parents:
diff changeset
4868 break;
Ritor1
parents:
diff changeset
4869 case 1:
Ritor1
parents:
diff changeset
4870 playerAffected->sResAirBase += thisa;
Ritor1
parents:
diff changeset
4871 v13 = pGlobalTXT_LocalizationStrings[6];//Air
Ritor1
parents:
diff changeset
4872 break;
Ritor1
parents:
diff changeset
4873 case 2:
Ritor1
parents:
diff changeset
4874 playerAffected->sResWaterBase += thisa;
Ritor1
parents:
diff changeset
4875 v13 = pGlobalTXT_LocalizationStrings[240];//Water
Ritor1
parents:
diff changeset
4876 break;
Ritor1
parents:
diff changeset
4877 case 3:
Ritor1
parents:
diff changeset
4878 playerAffected->sResEarthBase += thisa;
Ritor1
parents:
diff changeset
4879 v13 = pGlobalTXT_LocalizationStrings[70];//Earth
Ritor1
parents:
diff changeset
4880 break;
Ritor1
parents:
diff changeset
4881 case 4:
Ritor1
parents:
diff changeset
4882 playerAffected->sResMindBase += thisa;
Ritor1
parents:
diff changeset
4883 v13 = pGlobalTXT_LocalizationStrings[142];//Mind
Ritor1
parents:
diff changeset
4884 break;
Ritor1
parents:
diff changeset
4885 case 5:
Ritor1
parents:
diff changeset
4886 playerAffected->sResBodyBase += thisa;
Ritor1
parents:
diff changeset
4887 v13 = pGlobalTXT_LocalizationStrings[29];//Body
Ritor1
parents:
diff changeset
4888 break;
Ritor1
parents:
diff changeset
4889 default: ("Unexpected attribute");
Ritor1
parents:
diff changeset
4890 return;
Ritor1
parents:
diff changeset
4891 }
Ritor1
parents:
diff changeset
4892 sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);//Permanent
Ritor1
parents:
diff changeset
4893 break;
Ritor1
parents:
diff changeset
4894
Ritor1
parents:
diff changeset
4895 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4896 ShowStatusBarString(pTmpBuf.data(), 2);
2498
Ritor1
parents:
diff changeset
4897 pMouse->RemoveHoldingItem();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4898 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
2498
Ritor1
parents:
diff changeset
4899 playerAffected->PlaySound(SPEECH_93, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4900 pAudioPlayer->PlaySound(SOUND_chimes, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4901 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 )
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4902 {
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4903 playerAffected->SetCondition(Condition_Eradicated, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4904 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4905 }
2498
Ritor1
parents:
diff changeset
4906 else if ( pParty->uDaysPlayed == 12 || pParty->uDaysPlayed == 26 )
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4907 {
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4908 playerAffected->SetCondition(Condition_Dead, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4909 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4910 }
2498
Ritor1
parents:
diff changeset
4911 else if ( pParty->uDaysPlayed == 4 || pParty->uDaysPlayed == 25 )
Ritor1
parents:
diff changeset
4912 {
Ritor1
parents:
diff changeset
4913 playerAffected->SetCondition(Condition_Pertified, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4914 pAudioPlayer->PlaySound(SOUND_gong, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4915 }
Ritor1
parents:
diff changeset
4916 return;
Ritor1
parents:
diff changeset
4917 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4918 else if (pParty->pPickedItem.uItemID == ITEM_RED_APPLE)
2498
Ritor1
parents:
diff changeset
4919 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4920 Party::GiveFood(1);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4921 pAudioPlayer->PlaySound(SOUND_eat, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4922 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4923 else if (pParty->pPickedItem.uItemID == ITEM_LUTE)
2498
Ritor1
parents:
diff changeset
4924 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4925 pAudioPlayer->PlaySound(SOUND_luteguitar, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4926 return;
Ritor1
parents:
diff changeset
4927 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4928 else if (pParty->pPickedItem.uItemID == ITEM_FAERIE_PIPES)
2498
Ritor1
parents:
diff changeset
4929 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4930 pAudioPlayer->PlaySound(SOUND_panflute, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4931 return;
Ritor1
parents:
diff changeset
4932 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4933 else if (pParty->pPickedItem.uItemID == ITEM_GRYPHONHEARTS_TRUMPET)
2498
Ritor1
parents:
diff changeset
4934 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4935 pAudioPlayer->PlaySound(SOUND_trumpet, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4936 return;
Ritor1
parents:
diff changeset
4937 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4938 else if (pParty->pPickedItem.uItemID == ITEM_HORSESHOE)
2498
Ritor1
parents:
diff changeset
4939 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
4940 pEngine->pStru6Instance->SetPlayerBuffAnim(SPELL_QUEST_COMPLETED, player_num - 1);
2498
Ritor1
parents:
diff changeset
4941 v5 = PID(OBJECT_Player, player_num + 49);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
4942 pAudioPlayer->PlaySound(SOUND_quest, v5, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4943 playerAffected->AddVariable(VAR_NumSkillPoints, 2);
Ritor1
parents:
diff changeset
4944 }
2567
d569340b05ff Few constants changed into enum values
a.parshin
parents: 2566
diff changeset
4945 else if (pParty->pPickedItem.uItemID == ITEM_TEMPLE_IN_A_BOTTLE)
2498
Ritor1
parents:
diff changeset
4946 {
Ritor1
parents:
diff changeset
4947 TeleportToNWCDungeon();
Ritor1
parents:
diff changeset
4948 return;
Ritor1
parents:
diff changeset
4949 }
Ritor1
parents:
diff changeset
4950 else
Ritor1
parents:
diff changeset
4951 {
Ritor1
parents:
diff changeset
4952 v68 = pParty->pPickedItem.GetDisplayName();
Ritor1
parents:
diff changeset
4953 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4954 ShowStatusBarString(pTmpBuf.data(), 2);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4955 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
4956 return;
Ritor1
parents:
diff changeset
4957 }
Ritor1
parents:
diff changeset
4958
Ritor1
parents:
diff changeset
4959 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
4960 return;
Ritor1
parents:
diff changeset
4961 }
Ritor1
parents:
diff changeset
4962 }
Ritor1
parents:
diff changeset
4963
Ritor1
parents:
diff changeset
4964 bool CmpSkillValue(int valToCompare, int skillValue)
Ritor1
parents:
diff changeset
4965 {
Ritor1
parents:
diff changeset
4966 int v4;
Ritor1
parents:
diff changeset
4967 if ( valToCompare <= 63 )
Ritor1
parents:
diff changeset
4968 v4 = skillValue & 0x3F;
Ritor1
parents:
diff changeset
4969 else
Ritor1
parents:
diff changeset
4970 v4 = skillValue & skillValue;
Ritor1
parents:
diff changeset
4971 return v4 >= valToCompare;
Ritor1
parents:
diff changeset
4972 }
Ritor1
parents:
diff changeset
4973
Ritor1
parents:
diff changeset
4974 //----- (00449BB4) --------------------------------------------------------
Ritor1
parents:
diff changeset
4975 bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default
Ritor1
parents:
diff changeset
4976 {
Ritor1
parents:
diff changeset
4977 Assert(pValue >= 0, "Compare variable shouldn't have negative arguments");
Ritor1
parents:
diff changeset
4978
Ritor1
parents:
diff changeset
4979 signed int v4; // edi@1
Ritor1
parents:
diff changeset
4980 unsigned __int8 test_bit_value; // eax@25
Ritor1
parents:
diff changeset
4981 unsigned __int8 byteWithRequestedBit; // cl@25
Ritor1
parents:
diff changeset
4982 DDM_DLV_Header *v19; // eax@122
Ritor1
parents:
diff changeset
4983 DDM_DLV_Header *v21; // eax@126
Ritor1
parents:
diff changeset
4984 int actStat; // ebx@161
Ritor1
parents:
diff changeset
4985 int baseStat; // eax@161
Ritor1
parents:
diff changeset
4986
Ritor1
parents:
diff changeset
4987
Ritor1
parents:
diff changeset
4988 if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
4989 return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0; // originally (unsigned __int8)byte_5E4C15[VarNum];
Ritor1
parents:
diff changeset
4990 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
4991 return (unsigned __int8)stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] > 0; //not really sure whether the number gets up to 99, but can't ignore the possibility
Ritor1
parents:
diff changeset
4992
Ritor1
parents:
diff changeset
4993 switch ( VarNum )
Ritor1
parents:
diff changeset
4994 {
Ritor1
parents:
diff changeset
4995 case VAR_Sex:
Ritor1
parents:
diff changeset
4996 return ( pValue == this->uSex );
Ritor1
parents:
diff changeset
4997 case VAR_Class:
Ritor1
parents:
diff changeset
4998 return ( pValue == this->classType );
Ritor1
parents:
diff changeset
4999 case VAR_Race:
Ritor1
parents:
diff changeset
5000 return pValue == GetRace();
Ritor1
parents:
diff changeset
5001 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
5002 return this->sHealth >= pValue;
Ritor1
parents:
diff changeset
5003 case VAR_MaxHP:
Ritor1
parents:
diff changeset
5004 return (this->sHealth >= GetMaxHealth());
Ritor1
parents:
diff changeset
5005 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
5006 return this->sMana >= pValue;
Ritor1
parents:
diff changeset
5007 case VAR_MaxSP:
Ritor1
parents:
diff changeset
5008 return (this->sMana >= GetMaxMana());
Ritor1
parents:
diff changeset
5009 case VAR_ActualAC:
Ritor1
parents:
diff changeset
5010 return GetActualAC() >= pValue;
Ritor1
parents:
diff changeset
5011 case VAR_ACModifier:
Ritor1
parents:
diff changeset
5012 return this->sACModifier >= pValue;
Ritor1
parents:
diff changeset
5013 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
5014 return this->uLevel >= pValue;
Ritor1
parents:
diff changeset
5015 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
5016 return this->sLevelModifier >= pValue;
Ritor1
parents:
diff changeset
5017 case VAR_Age:
Ritor1
parents:
diff changeset
5018 return GetActualAge() >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5019 case VAR_Award:
Ritor1
parents:
diff changeset
5020 return _449B57_test_bit(this->_achieved_awards_bits, pValue);
Ritor1
parents:
diff changeset
5021 case VAR_Experience:
Ritor1
parents:
diff changeset
5022 return this->uExperience >= pValue; //TODO change pValue to long long
Ritor1
parents:
diff changeset
5023 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
5024 return _449B57_test_bit(pParty->_quest_bits, pValue);
Ritor1
parents:
diff changeset
5025 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
5026 //for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
5027 for (int i = 0; i < 126; i++)
Ritor1
parents:
diff changeset
5028 {
Ritor1
parents:
diff changeset
5029 if (pInventoryItemList[i].uItemID == pValue)
Ritor1
parents:
diff changeset
5030 {
Ritor1
parents:
diff changeset
5031 return true;
Ritor1
parents:
diff changeset
5032 }
Ritor1
parents:
diff changeset
5033 }
Ritor1
parents:
diff changeset
5034 return pParty->pPickedItem.uItemID == pValue;
Ritor1
parents:
diff changeset
5035 case VAR_Hour:
Ritor1
parents:
diff changeset
5036 if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue )
Ritor1
parents:
diff changeset
5037 return true;
Ritor1
parents:
diff changeset
5038 return false;
Ritor1
parents:
diff changeset
5039 case VAR_DayOfYear:
Ritor1
parents:
diff changeset
5040 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue)
Ritor1
parents:
diff changeset
5041 return true;
Ritor1
parents:
diff changeset
5042 return false;
Ritor1
parents:
diff changeset
5043 case VAR_DayOfWeek:
Ritor1
parents:
diff changeset
5044 if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7)
Ritor1
parents:
diff changeset
5045 return true;
Ritor1
parents:
diff changeset
5046 return false;
Ritor1
parents:
diff changeset
5047 case VAR_FixedGold:
Ritor1
parents:
diff changeset
5048 return pParty->uNumGold >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5049 case VAR_FixedFood:
Ritor1
parents:
diff changeset
5050 return pParty->uNumFoodRations >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5051 case VAR_MightBonus:
Ritor1
parents:
diff changeset
5052 return this->uMightBonus >= pValue;
Ritor1
parents:
diff changeset
5053 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
5054 return this->uIntelligenceBonus >= pValue;
Ritor1
parents:
diff changeset
5055 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
5056 return this->uWillpowerBonus >= pValue;
Ritor1
parents:
diff changeset
5057 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
5058 return this->uEnduranceBonus >= pValue;
Ritor1
parents:
diff changeset
5059 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
5060 return this->uSpeedBonus >= pValue;
Ritor1
parents:
diff changeset
5061 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
5062 return this->uAccuracyBonus >= pValue;
Ritor1
parents:
diff changeset
5063 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
5064 return this->uLuckBonus >= pValue;
Ritor1
parents:
diff changeset
5065 case VAR_BaseMight:
Ritor1
parents:
diff changeset
5066 return this->uMight >= pValue;
Ritor1
parents:
diff changeset
5067 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
5068 return this->uIntelligence >= pValue;
Ritor1
parents:
diff changeset
5069 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
5070 return this->uWillpower >= pValue;
Ritor1
parents:
diff changeset
5071 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
5072 return this->uEndurance >= pValue;
Ritor1
parents:
diff changeset
5073 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
5074 return this->uSpeed >= pValue;
Ritor1
parents:
diff changeset
5075 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
5076 return this->uAccuracy >= pValue;
Ritor1
parents:
diff changeset
5077 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
5078 return this->uLuck >= pValue;
Ritor1
parents:
diff changeset
5079 case VAR_ActualMight:
Ritor1
parents:
diff changeset
5080 return GetActualMight() >= pValue;
Ritor1
parents:
diff changeset
5081 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
5082 return GetActualIntelligence() >= pValue;
Ritor1
parents:
diff changeset
5083 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
5084 return GetActualWillpower() >= pValue;
Ritor1
parents:
diff changeset
5085 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
5086 return GetActualEndurance() >= pValue;
Ritor1
parents:
diff changeset
5087 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
5088 return GetActualSpeed() >= pValue;
Ritor1
parents:
diff changeset
5089 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
5090 return GetActualAccuracy() >= pValue;
Ritor1
parents:
diff changeset
5091 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
5092 return GetActualLuck() >= pValue;
Ritor1
parents:
diff changeset
5093 case VAR_FireResistance:
Ritor1
parents:
diff changeset
5094 return this->sResFireBase >= pValue;
Ritor1
parents:
diff changeset
5095 case VAR_AirResistance:
Ritor1
parents:
diff changeset
5096 return this->sResAirBase >= pValue;
Ritor1
parents:
diff changeset
5097 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
5098 return this->sResWaterBase >= pValue;
Ritor1
parents:
diff changeset
5099 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
5100 return this->sResEarthBase >= pValue;
Ritor1
parents:
diff changeset
5101 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
5102 return this->sResSpiritBase >= pValue;
Ritor1
parents:
diff changeset
5103 case VAR_MindResistance:
Ritor1
parents:
diff changeset
5104 return this->sResMindBase >= pValue;
Ritor1
parents:
diff changeset
5105 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
5106 return this->sResBodyBase >= pValue;
Ritor1
parents:
diff changeset
5107 case VAR_LightResistance:
Ritor1
parents:
diff changeset
5108 return this->sResLightBase >= pValue;
Ritor1
parents:
diff changeset
5109 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
5110 return this->sResDarkBase >= pValue;
Ritor1
parents:
diff changeset
5111 case VAR_PhysicalResistance:
Ritor1
parents:
diff changeset
5112 Error("Physical resistance isn't used in events");
Ritor1
parents:
diff changeset
5113 return false;
Ritor1
parents:
diff changeset
5114 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
5115 return this->sResMagicBase >= pValue;
Ritor1
parents:
diff changeset
5116 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
5117 return this->sResFireBonus >= pValue;
Ritor1
parents:
diff changeset
5118 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
5119 return this->sResAirBonus >= pValue;
Ritor1
parents:
diff changeset
5120 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
5121 return this->sResWaterBonus >= pValue;
Ritor1
parents:
diff changeset
5122 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
5123 return this->sResEarthBonus >= pValue;
Ritor1
parents:
diff changeset
5124 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
5125 return this->sResSpiritBonus >= pValue;
Ritor1
parents:
diff changeset
5126 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
5127 return this->sResMindBonus >= pValue;
Ritor1
parents:
diff changeset
5128 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
5129 return this->sResBodyBonus >= pValue;
Ritor1
parents:
diff changeset
5130 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
5131 return this->sResLightBonus >= pValue;
Ritor1
parents:
diff changeset
5132 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
5133 return this->sResDarkBonus >= pValue;
Ritor1
parents:
diff changeset
5134 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
5135 return this->sResMagicBonus >= pValue;
Ritor1
parents:
diff changeset
5136 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
5137 return CmpSkillValue(pValue, this->skillStaff);
Ritor1
parents:
diff changeset
5138 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
5139 return CmpSkillValue(pValue, this->skillSword);
Ritor1
parents:
diff changeset
5140 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
5141 return CmpSkillValue(pValue, this->skillDagger);
Ritor1
parents:
diff changeset
5142 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
5143 return CmpSkillValue(pValue, this->skillAxe);
Ritor1
parents:
diff changeset
5144 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
5145 return CmpSkillValue(pValue, this->skillSpear);
Ritor1
parents:
diff changeset
5146 case VAR_BowSkill:
Ritor1
parents:
diff changeset
5147 return CmpSkillValue(pValue, this->skillBow);
Ritor1
parents:
diff changeset
5148 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
5149 return CmpSkillValue(pValue, this->skillMace);
Ritor1
parents:
diff changeset
5150 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
5151 return CmpSkillValue(pValue, this->skillBlaster);
Ritor1
parents:
diff changeset
5152 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
5153 return CmpSkillValue(pValue, this->skillShield);
Ritor1
parents:
diff changeset
5154 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
5155 return CmpSkillValue(pValue, this->skillLeather);
Ritor1
parents:
diff changeset
5156 case VAR_SkillChain:
Ritor1
parents:
diff changeset
5157 return CmpSkillValue(pValue, this->skillChain);
Ritor1
parents:
diff changeset
5158 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
5159 return CmpSkillValue(pValue, this->skillPlate);
Ritor1
parents:
diff changeset
5160 case VAR_FireSkill:
Ritor1
parents:
diff changeset
5161 return CmpSkillValue(pValue, this->skillFire);
Ritor1
parents:
diff changeset
5162 case VAR_AirSkill:
Ritor1
parents:
diff changeset
5163 return CmpSkillValue(pValue, this->skillAir);
Ritor1
parents:
diff changeset
5164 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
5165 return CmpSkillValue(pValue, this->skillWater);
Ritor1
parents:
diff changeset
5166 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
5167 return CmpSkillValue(pValue, this->skillEarth);
Ritor1
parents:
diff changeset
5168 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
5169 return CmpSkillValue(pValue, this->skillSpirit);
Ritor1
parents:
diff changeset
5170 case VAR_MindSkill:
Ritor1
parents:
diff changeset
5171 return CmpSkillValue(pValue, this->skillMind);
Ritor1
parents:
diff changeset
5172 case VAR_BodySkill:
Ritor1
parents:
diff changeset
5173 return CmpSkillValue(pValue, this->skillBody);
Ritor1
parents:
diff changeset
5174 case VAR_LightSkill:
Ritor1
parents:
diff changeset
5175 return CmpSkillValue(pValue, this->skillLight);
Ritor1
parents:
diff changeset
5176 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
5177 return CmpSkillValue(pValue, this->skillDark);
Ritor1
parents:
diff changeset
5178 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
5179 return CmpSkillValue(pValue, this->skillItemId);
Ritor1
parents:
diff changeset
5180 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
5181 return CmpSkillValue(pValue, this->skillMerchant);
Ritor1
parents:
diff changeset
5182 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
5183 return CmpSkillValue(pValue, this->skillRepair);
Ritor1
parents:
diff changeset
5184 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
5185 return CmpSkillValue(pValue, this->skillBodybuilding);
Ritor1
parents:
diff changeset
5186 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
5187 return CmpSkillValue(pValue, this->skillMeditation);
Ritor1
parents:
diff changeset
5188 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
5189 return CmpSkillValue(pValue, this->skillPerception);
Ritor1
parents:
diff changeset
5190 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
5191 return CmpSkillValue(pValue, this->skillDiplomacy);
Ritor1
parents:
diff changeset
5192 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
5193 Error("Thievery isn't used in events");
Ritor1
parents:
diff changeset
5194 return false;
Ritor1
parents:
diff changeset
5195 case VAR_DisarmTrapSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5196 return CmpSkillValue(pValue, this->skillDisarmTrap);
Ritor1
parents:
diff changeset
5197 case VAR_DodgeSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5198 return CmpSkillValue(pValue, this->skillDodge);
Ritor1
parents:
diff changeset
5199 case VAR_UnarmedSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5200 return CmpSkillValue(pValue, this->skillUnarmed);
Ritor1
parents:
diff changeset
5201 case VAR_IdentifyMonsterSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5202 return CmpSkillValue(pValue, this->skillMonsterId);
Ritor1
parents:
diff changeset
5203 case VAR_ArmsmasterSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5204 return CmpSkillValue(pValue, this->skillArmsmaster);
Ritor1
parents:
diff changeset
5205 case VAR_StealingSkill: //wasn't in the original
Ritor1
parents:
diff changeset
5206 return CmpSkillValue(pValue, this->skillStealing);
Ritor1
parents:
diff changeset
5207 case VAR_AlchemySkill: //wasn't in the original
Ritor1
parents:
diff changeset
5208 return CmpSkillValue(pValue, this->skillAlchemy);
Ritor1
parents:
diff changeset
5209 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
5210 return CmpSkillValue(pValue, this->skillLearning);
Ritor1
parents:
diff changeset
5211 case VAR_Cursed:
Ritor1
parents:
diff changeset
5212 return pConditions[Condition_Cursed] > 0;
Ritor1
parents:
diff changeset
5213 case VAR_Weak:
Ritor1
parents:
diff changeset
5214 return pConditions[Condition_Weak] > 0;
Ritor1
parents:
diff changeset
5215 case VAR_Asleep:
Ritor1
parents:
diff changeset
5216 return pConditions[Condition_Sleep] > 0;
Ritor1
parents:
diff changeset
5217 case VAR_Afraid:
Ritor1
parents:
diff changeset
5218 return pConditions[Condition_Fear] > 0;
Ritor1
parents:
diff changeset
5219 case VAR_Drunk:
Ritor1
parents:
diff changeset
5220 return pConditions[Condition_Drunk] > 0;
Ritor1
parents:
diff changeset
5221 case VAR_Insane:
Ritor1
parents:
diff changeset
5222 return pConditions[Condition_Insane] > 0;
Ritor1
parents:
diff changeset
5223 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
5224 return pConditions[Condition_Poison_Weak] > 0;
Ritor1
parents:
diff changeset
5225 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
5226 return pConditions[Condition_Disease_Weak] > 0;
Ritor1
parents:
diff changeset
5227 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
5228 return pConditions[Condition_Poison_Medium] > 0;
Ritor1
parents:
diff changeset
5229 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
5230 return pConditions[Condition_Disease_Medium] > 0;
Ritor1
parents:
diff changeset
5231 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
5232 return pConditions[Condition_Poison_Severe] > 0;
Ritor1
parents:
diff changeset
5233 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
5234 return pConditions[Condition_Disease_Severe] > 0;
Ritor1
parents:
diff changeset
5235 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
5236 return pConditions[Condition_Paralyzed] > 0;
Ritor1
parents:
diff changeset
5237 case VAR_Unconsious:
Ritor1
parents:
diff changeset
5238 return pConditions[Condition_Unconcious] > 0;
Ritor1
parents:
diff changeset
5239 case VAR_Dead:
Ritor1
parents:
diff changeset
5240 return pConditions[Condition_Dead] > 0;
Ritor1
parents:
diff changeset
5241 case VAR_Stoned:
Ritor1
parents:
diff changeset
5242 return pConditions[Condition_Pertified] > 0;
Ritor1
parents:
diff changeset
5243 case VAR_Eradicated:
Ritor1
parents:
diff changeset
5244 return pConditions[Condition_Eradicated] > 0;
Ritor1
parents:
diff changeset
5245 case VAR_MajorCondition:
Ritor1
parents:
diff changeset
5246 v4 = GetMajorConditionIdx();
Ritor1
parents:
diff changeset
5247 if ( v4 != 18 )
Ritor1
parents:
diff changeset
5248 {
Ritor1
parents:
diff changeset
5249 return v4 >= pValue;
Ritor1
parents:
diff changeset
5250 }
Ritor1
parents:
diff changeset
5251 return true;
Ritor1
parents:
diff changeset
5252 case VAR_AutoNotes : //TODO: find out why the double subtraction. or whether this is even used
Ritor1
parents:
diff changeset
5253 test_bit_value = 0x80u >> (pValue - 2) % 8;
Ritor1
parents:
diff changeset
5254 byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8];
Ritor1
parents:
diff changeset
5255 return (test_bit_value & byteWithRequestedBit) != 0;
Ritor1
parents:
diff changeset
5256 case VAR_IsMightMoreThanBase:
Ritor1
parents:
diff changeset
5257 actStat = GetActualMight();
Ritor1
parents:
diff changeset
5258 baseStat = GetBaseStrength();
Ritor1
parents:
diff changeset
5259 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5260 case VAR_IsIntellectMoreThanBase:
Ritor1
parents:
diff changeset
5261 actStat = GetActualIntelligence();
Ritor1
parents:
diff changeset
5262 baseStat = GetBaseIntelligence();
Ritor1
parents:
diff changeset
5263 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5264 case VAR_IsPersonalityMoreThanBase:
Ritor1
parents:
diff changeset
5265 actStat = GetActualWillpower();
Ritor1
parents:
diff changeset
5266 baseStat = GetBaseWillpower();
Ritor1
parents:
diff changeset
5267 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5268 case VAR_IsEnduranceMoreThanBase:
Ritor1
parents:
diff changeset
5269 actStat = GetActualEndurance();
Ritor1
parents:
diff changeset
5270 baseStat = GetBaseEndurance();
Ritor1
parents:
diff changeset
5271 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5272 case VAR_IsSpeedMoreThanBase:
Ritor1
parents:
diff changeset
5273 actStat = GetActualSpeed();
Ritor1
parents:
diff changeset
5274 baseStat = GetBaseSpeed();
Ritor1
parents:
diff changeset
5275 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5276 case VAR_IsAccuracyMoreThanBase:
Ritor1
parents:
diff changeset
5277 actStat = GetActualAccuracy();
Ritor1
parents:
diff changeset
5278 baseStat = GetBaseAccuracy();
Ritor1
parents:
diff changeset
5279 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5280 case VAR_IsLuckMoreThanBase:
Ritor1
parents:
diff changeset
5281 actStat = GetActualLuck();
Ritor1
parents:
diff changeset
5282 baseStat = GetBaseLuck();
Ritor1
parents:
diff changeset
5283 return (actStat >= baseStat);
Ritor1
parents:
diff changeset
5284 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
5285 test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
Ritor1
parents:
diff changeset
5286 byteWithRequestedBit = this->playerEventBits[((signed __int16)pValue - 1)/8];
Ritor1
parents:
diff changeset
5287 return ( test_bit_value & byteWithRequestedBit ) != 0;
Ritor1
parents:
diff changeset
5288 case VAR_NPCs2:
Ritor1
parents:
diff changeset
5289 return pNPCStats->pNewNPCData[pValue].Hired();
Ritor1
parents:
diff changeset
5290 case VAR_IsFlying:
Ritor1
parents:
diff changeset
5291 if ( pParty->bFlying
Ritor1
parents:
diff changeset
5292 && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) )
Ritor1
parents:
diff changeset
5293 return true;
Ritor1
parents:
diff changeset
5294 return false;
Ritor1
parents:
diff changeset
5295 case VAR_HiredNPCHasSpeciality:
Ritor1
parents:
diff changeset
5296 return CheckHiredNPCSpeciality(pValue);
Ritor1
parents:
diff changeset
5297 case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration
Ritor1
parents:
diff changeset
5298 v4 = 0;
Ritor1
parents:
diff changeset
5299 for (int playerNum = 0; playerNum < 4; playerNum++)
Ritor1
parents:
diff changeset
5300 {
Ritor1
parents:
diff changeset
5301 for (int invPos = 0; invPos < 138; invPos++)
Ritor1
parents:
diff changeset
5302 {
Ritor1
parents:
diff changeset
5303 int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID;
Ritor1
parents:
diff changeset
5304 switch ( itemId )
Ritor1
parents:
diff changeset
5305 {
Ritor1
parents:
diff changeset
5306 case 0x1D6u:
Ritor1
parents:
diff changeset
5307 ++v4;
Ritor1
parents:
diff changeset
5308 break;
Ritor1
parents:
diff changeset
5309 case 0x1D7u:
Ritor1
parents:
diff changeset
5310 v4 += 3;
Ritor1
parents:
diff changeset
5311 break;
Ritor1
parents:
diff changeset
5312 case 0x1DDu:
Ritor1
parents:
diff changeset
5313 v4 += 5;
Ritor1
parents:
diff changeset
5314 break;
Ritor1
parents:
diff changeset
5315 }
Ritor1
parents:
diff changeset
5316 }
Ritor1
parents:
diff changeset
5317 }
Ritor1
parents:
diff changeset
5318 return v4 >= pValue;
Ritor1
parents:
diff changeset
5319 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
5320 return this->uSkillPoints >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5321 case VAR_MonthIs:
Ritor1
parents:
diff changeset
5322 return (pParty->uCurrentMonth == (unsigned int)pValue);
Ritor1
parents:
diff changeset
5323 case VAR_Counter1:
Ritor1
parents:
diff changeset
5324 case VAR_Counter2:
Ritor1
parents:
diff changeset
5325 case VAR_Counter3:
Ritor1
parents:
diff changeset
5326 case VAR_Counter4:
Ritor1
parents:
diff changeset
5327 case VAR_Counter5:
Ritor1
parents:
diff changeset
5328 case VAR_Counter6:
Ritor1
parents:
diff changeset
5329 case VAR_Counter7:
Ritor1
parents:
diff changeset
5330 case VAR_Counter8:
Ritor1
parents:
diff changeset
5331 case VAR_Counter9:
Ritor1
parents:
diff changeset
5332 case VAR_Counter10:
Ritor1
parents:
diff changeset
5333 if (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1]) //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300])
Ritor1
parents:
diff changeset
5334 {
Ritor1
parents:
diff changeset
5335 return (pParty->PartyTimes.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ;
Ritor1
parents:
diff changeset
5336 }
Ritor1
parents:
diff changeset
5337 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
5338 v19 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5339 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5340 v19 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5341 return (v19->uReputation >= pValue);
Ritor1
parents:
diff changeset
5342 case VAR_Unknown1:
Ritor1
parents:
diff changeset
5343 v21 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5344 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5345 v21 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5346 return (v21->field_C_alert == pValue); //yes, equality, not >=
Ritor1
parents:
diff changeset
5347 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
5348 return pParty->uNumGoldInBank >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5349 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
5350 return pParty->uNumDeaths >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5351 case VAR_NumBounties:
Ritor1
parents:
diff changeset
5352 return pParty->uNumBountiesCollected >= (unsigned int)pValue;
Ritor1
parents:
diff changeset
5353 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
5354 return pParty->uNumPrisonTerms >= pValue;
Ritor1
parents:
diff changeset
5355 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
5356 return (unsigned __int8)pParty->uNumArenaPageWins >= pValue;
Ritor1
parents:
diff changeset
5357 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
5358 return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue;
Ritor1
parents:
diff changeset
5359 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
5360 return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue;
Ritor1
parents:
diff changeset
5361 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
5362 return pParty->uNumArenaLordWins >= pValue;
Ritor1
parents:
diff changeset
5363 case VAR_Invisible:
Ritor1
parents:
diff changeset
5364 return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 );
Ritor1
parents:
diff changeset
5365 case VAR_ItemEquipped:
Ritor1
parents:
diff changeset
5366 for (int i = 0; i < 16; i++)
Ritor1
parents:
diff changeset
5367 {
Ritor1
parents:
diff changeset
5368 if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue )
Ritor1
parents:
diff changeset
5369 {
Ritor1
parents:
diff changeset
5370 return true;
Ritor1
parents:
diff changeset
5371 }
Ritor1
parents:
diff changeset
5372 }
Ritor1
parents:
diff changeset
5373 return false;
Ritor1
parents:
diff changeset
5374 }
Ritor1
parents:
diff changeset
5375
Ritor1
parents:
diff changeset
5376 return false;
Ritor1
parents:
diff changeset
5377 }
Ritor1
parents:
diff changeset
5378
Ritor1
parents:
diff changeset
5379
Ritor1
parents:
diff changeset
5380 //----- (0044A5CB) --------------------------------------------------------
Ritor1
parents:
diff changeset
5381 void Player::SetVariable(enum VariableType var_type, signed int var_value)
Ritor1
parents:
diff changeset
5382 {
Ritor1
parents:
diff changeset
5383 unsigned int v6; // esi@13
Ritor1
parents:
diff changeset
5384 unsigned int v7; // esi@14
Ritor1
parents:
diff changeset
5385 signed int v11; // eax@30
Ritor1
parents:
diff changeset
5386 DDM_DLV_Header *v24; // ecx@148
Ritor1
parents:
diff changeset
5387 ItemGen item; // [sp+Ch] [bp-28h]@52
Ritor1
parents:
diff changeset
5388
Ritor1
parents:
diff changeset
5389
Ritor1
parents:
diff changeset
5390 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
Ritor1
parents:
diff changeset
5391 {
Ritor1
parents:
diff changeset
5392 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
Ritor1
parents:
diff changeset
5393 {
Ritor1
parents:
diff changeset
5394 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
5395 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText)
Ritor1
parents:
diff changeset
5396 {
Ritor1
parents:
diff changeset
5397 bFlashHistoryBook = 1;
Ritor1
parents:
diff changeset
5398 PlayAwardSound();
Ritor1
parents:
diff changeset
5399 }
Ritor1
parents:
diff changeset
5400 }
Ritor1
parents:
diff changeset
5401 return;
Ritor1
parents:
diff changeset
5402 }
Ritor1
parents:
diff changeset
5403
Ritor1
parents:
diff changeset
5404 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5405 {
Ritor1
parents:
diff changeset
5406 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
5407 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = (char)var_value; // originally (unsigned __int8)byte_5E4C15[VarNum];
Ritor1
parents:
diff changeset
5408 if ( var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
5409 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = (unsigned char)var_value; //not really sure whether the number gets up to 99, but can't ignore the possibility
Ritor1
parents:
diff changeset
5410 return;
Ritor1
parents:
diff changeset
5411 }
Ritor1
parents:
diff changeset
5412
Ritor1
parents:
diff changeset
5413 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
Ritor1
parents:
diff changeset
5414 {
Ritor1
parents:
diff changeset
5415 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed
Ritor1
parents:
diff changeset
5416 PlayAwardSound();
Ritor1
parents:
diff changeset
5417 return;
Ritor1
parents:
diff changeset
5418 }
Ritor1
parents:
diff changeset
5419
Ritor1
parents:
diff changeset
5420 switch ( var_type )
Ritor1
parents:
diff changeset
5421 {
Ritor1
parents:
diff changeset
5422 case VAR_Sex:
Ritor1
parents:
diff changeset
5423 this->uSex = (PLAYER_SEX)var_value;
Ritor1
parents:
diff changeset
5424 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5425 return;
Ritor1
parents:
diff changeset
5426 case VAR_Class:
Ritor1
parents:
diff changeset
5427 this->classType = (PLAYER_CLASS_TYPE)var_value;
Ritor1
parents:
diff changeset
5428 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH )
Ritor1
parents:
diff changeset
5429 {
Ritor1
parents:
diff changeset
5430 for (int i = 0; i < 138; i++)
Ritor1
parents:
diff changeset
5431 {
Ritor1
parents:
diff changeset
5432 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY)
Ritor1
parents:
diff changeset
5433 {
Ritor1
parents:
diff changeset
5434 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL;
Ritor1
parents:
diff changeset
5435 this->pOwnItems[i].uHolderPlayer = GetPlayerIndex() + 1;
Ritor1
parents:
diff changeset
5436 }
Ritor1
parents:
diff changeset
5437 }
Ritor1
parents:
diff changeset
5438 if ( this->sResFireBase < 20 )
Ritor1
parents:
diff changeset
5439 this->sResFireBase = 20;
Ritor1
parents:
diff changeset
5440 if ( this->sResAirBase < 20 )
Ritor1
parents:
diff changeset
5441 this->sResAirBase = 20;
Ritor1
parents:
diff changeset
5442 if ( this->sResWaterBase < 20 )
Ritor1
parents:
diff changeset
5443 this->sResWaterBase = 20;
Ritor1
parents:
diff changeset
5444 if ( this->sResEarthBase < 20 )
Ritor1
parents:
diff changeset
5445 this->sResEarthBase = 20;
Ritor1
parents:
diff changeset
5446 this->sResMindBase = 200;
Ritor1
parents:
diff changeset
5447 this->sResBodyBase = 200;
Ritor1
parents:
diff changeset
5448 v11 = this->GetSexByVoice();
Ritor1
parents:
diff changeset
5449 this->uPrevVoiceID = this->uVoiceID;
Ritor1
parents:
diff changeset
5450 this->uPrevFace = this->uCurrentFace;
Ritor1
parents:
diff changeset
5451 if ( v11 )
Ritor1
parents:
diff changeset
5452 {
Ritor1
parents:
diff changeset
5453 this->uCurrentFace = 21;
Ritor1
parents:
diff changeset
5454 this->uVoiceID = 21;
Ritor1
parents:
diff changeset
5455 }
Ritor1
parents:
diff changeset
5456 else
Ritor1
parents:
diff changeset
5457 {
Ritor1
parents:
diff changeset
5458 this->uCurrentFace = 20;
Ritor1
parents:
diff changeset
5459 this->uVoiceID = 20;
Ritor1
parents:
diff changeset
5460 }
Ritor1
parents:
diff changeset
5461 ReloadPlayerPortraits(GetPlayerIndex(), this->uCurrentFace);
Ritor1
parents:
diff changeset
5462 }
Ritor1
parents:
diff changeset
5463 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5464 return;
Ritor1
parents:
diff changeset
5465 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
5466 this->sHealth = var_value;
Ritor1
parents:
diff changeset
5467 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5468 return;
Ritor1
parents:
diff changeset
5469 case VAR_MaxHP:
Ritor1
parents:
diff changeset
5470 this->sHealth = GetMaxHealth();
Ritor1
parents:
diff changeset
5471 return;
Ritor1
parents:
diff changeset
5472 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
5473 this->sMana = var_value;
Ritor1
parents:
diff changeset
5474 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5475 return;
Ritor1
parents:
diff changeset
5476 case VAR_MaxSP:
Ritor1
parents:
diff changeset
5477 this->sMana = GetMaxMana();
Ritor1
parents:
diff changeset
5478 return;
Ritor1
parents:
diff changeset
5479 case VAR_ACModifier:
Ritor1
parents:
diff changeset
5480 this->sACModifier = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5481 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5482 return;
Ritor1
parents:
diff changeset
5483 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
5484 this->uLevel = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5485 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5486 return;
Ritor1
parents:
diff changeset
5487 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
5488 this->sLevelModifier = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5489 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5490 return;
Ritor1
parents:
diff changeset
5491 case VAR_Age:
Ritor1
parents:
diff changeset
5492 this->sAgeModifier = var_value;
Ritor1
parents:
diff changeset
5493 return;
Ritor1
parents:
diff changeset
5494 case VAR_Award:
Ritor1
parents:
diff changeset
5495 if ( !_449B57_test_bit(this->_achieved_awards_bits, var_value) && pAwards[var_value].pText )
Ritor1
parents:
diff changeset
5496 {
Ritor1
parents:
diff changeset
5497 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5498 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
5499 }
Ritor1
parents:
diff changeset
5500 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5501 return;
Ritor1
parents:
diff changeset
5502 case VAR_Experience:
Ritor1
parents:
diff changeset
5503 this->uExperience = var_value;
Ritor1
parents:
diff changeset
5504 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5505 return;
Ritor1
parents:
diff changeset
5506 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
5507 if ( !_449B57_test_bit(pParty->_quest_bits, var_value) && pQuestTable[var_value-1] )
Ritor1
parents:
diff changeset
5508 {
Ritor1
parents:
diff changeset
5509 bFlashQuestBook = 1;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5510 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
5511 PlayAwardSound();
Ritor1
parents:
diff changeset
5512 this->PlaySound(SPEECH_93, 0);
Ritor1
parents:
diff changeset
5513 }
Ritor1
parents:
diff changeset
5514 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5515 return;
Ritor1
parents:
diff changeset
5516 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
5517 item.Reset();
Ritor1
parents:
diff changeset
5518 item.uItemID = var_value;
Ritor1
parents:
diff changeset
5519 item.uAttributes = 1;
Ritor1
parents:
diff changeset
5520 pParty->SetHoldingItem(&item);
Ritor1
parents:
diff changeset
5521 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER )
Ritor1
parents:
diff changeset
5522 pParty->pIsArtifactFound[var_value-500] = 1;
Ritor1
parents:
diff changeset
5523 return;
Ritor1
parents:
diff changeset
5524 case VAR_FixedGold:
Ritor1
parents:
diff changeset
5525 Party::SetGold(var_value);
Ritor1
parents:
diff changeset
5526 return;
Ritor1
parents:
diff changeset
5527 case VAR_RandomGold:
Ritor1
parents:
diff changeset
5528 v6 = rand() % var_value + 1;
Ritor1
parents:
diff changeset
5529 Party::SetGold(v6);
Ritor1
parents:
diff changeset
5530 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
Ritor1
parents:
diff changeset
5531 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
5532 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
5533 return;
Ritor1
parents:
diff changeset
5534 case VAR_FixedFood:
Ritor1
parents:
diff changeset
5535 Party::SetFood(var_value);
Ritor1
parents:
diff changeset
5536 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5537 return;
Ritor1
parents:
diff changeset
5538 case VAR_RandomFood:
Ritor1
parents:
diff changeset
5539 v7 = rand() % var_value + 1;
Ritor1
parents:
diff changeset
5540 Party::SetFood(v7);
Ritor1
parents:
diff changeset
5541 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
Ritor1
parents:
diff changeset
5542 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
5543 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
5544 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5545 return;
Ritor1
parents:
diff changeset
5546 case VAR_BaseMight:
Ritor1
parents:
diff changeset
5547 this->uMight = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5548 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5549 return;
Ritor1
parents:
diff changeset
5550 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
5551 this->uIntelligence = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5552 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5553 return;
Ritor1
parents:
diff changeset
5554 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
5555 this->uWillpower = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5556 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5557 return;
Ritor1
parents:
diff changeset
5558 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
5559 this->uEndurance = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5560 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5561 return;
Ritor1
parents:
diff changeset
5562 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
5563 this->uSpeed = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5564 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5565 return;
Ritor1
parents:
diff changeset
5566 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
5567 this->uAccuracy = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5568 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5569 return;
Ritor1
parents:
diff changeset
5570 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
5571 this->uLuck = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5572 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5573 return;
Ritor1
parents:
diff changeset
5574 case VAR_MightBonus:
Ritor1
parents:
diff changeset
5575 case VAR_ActualMight:
Ritor1
parents:
diff changeset
5576 this->uMightBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5577 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5578 return;
Ritor1
parents:
diff changeset
5579 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
5580 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
5581 this->uIntelligenceBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5582 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5583 return;
Ritor1
parents:
diff changeset
5584 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
5585 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
5586 this->uWillpowerBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5587 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5588 return;
Ritor1
parents:
diff changeset
5589 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
5590 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
5591 this->uEnduranceBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5592 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5593 return;
Ritor1
parents:
diff changeset
5594 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
5595 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
5596 this->uSpeedBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5597 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5598 return;
Ritor1
parents:
diff changeset
5599 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
5600 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
5601 this->uAccuracyBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5602 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5603 return;
Ritor1
parents:
diff changeset
5604 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
5605 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
5606 this->uLuckBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5607 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5608 return;
Ritor1
parents:
diff changeset
5609 case VAR_FireResistance:
Ritor1
parents:
diff changeset
5610 this->sResFireBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5611 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5612 return;
Ritor1
parents:
diff changeset
5613 case VAR_AirResistance:
Ritor1
parents:
diff changeset
5614 this->sResAirBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5615 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5616 return;
Ritor1
parents:
diff changeset
5617 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
5618 this->sResWaterBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5619 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5620 return;
Ritor1
parents:
diff changeset
5621 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
5622 this->sResEarthBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5623 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5624 return;
Ritor1
parents:
diff changeset
5625 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
5626 this->sResSpiritBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5627 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5628 return;
Ritor1
parents:
diff changeset
5629 case VAR_MindResistance:
Ritor1
parents:
diff changeset
5630 this->sResMindBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5631 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5632 return;
Ritor1
parents:
diff changeset
5633 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
5634 this->sResBodyBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5635 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5636 return;
Ritor1
parents:
diff changeset
5637 case VAR_LightResistance:
Ritor1
parents:
diff changeset
5638 this->sResLightBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5639 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5640 return;
Ritor1
parents:
diff changeset
5641 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
5642 this->sResDarkBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5643 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5644 return;
Ritor1
parents:
diff changeset
5645 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
5646 this->sResMagicBase = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5647 PlayAwardSound_Anim_Face(SPEECH_92);
Ritor1
parents:
diff changeset
5648 return;
Ritor1
parents:
diff changeset
5649 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
5650 this->sResFireBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5651 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5652 return;
Ritor1
parents:
diff changeset
5653 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
5654 this->sResAirBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5655 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5656 return;
Ritor1
parents:
diff changeset
5657 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
5658 this->sResWaterBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5659 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5660 return;
Ritor1
parents:
diff changeset
5661 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
5662 this->sResEarthBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5663 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5664 return;
Ritor1
parents:
diff changeset
5665 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
5666 this->sResSpiritBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5667 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5668 return;
Ritor1
parents:
diff changeset
5669 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
5670 this->sResMindBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5671 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5672 return;
Ritor1
parents:
diff changeset
5673 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
5674 this->sResBodyBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5675 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5676 return;
Ritor1
parents:
diff changeset
5677 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
5678 this->sResLightBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5679 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5680 return;
Ritor1
parents:
diff changeset
5681 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
5682 this->sResDarkBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5683 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5684 return;
Ritor1
parents:
diff changeset
5685 case VAR_PhysicalResistanceBonus:
Ritor1
parents:
diff changeset
5686 Error("Physical res. bonus not used");
Ritor1
parents:
diff changeset
5687 return;
Ritor1
parents:
diff changeset
5688 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
5689 this->sResMagicBonus = (unsigned __int8)var_value;
Ritor1
parents:
diff changeset
5690 PlayAwardSound_Anim_Face(SPEECH_91);
Ritor1
parents:
diff changeset
5691 return;
Ritor1
parents:
diff changeset
5692 case VAR_Cursed:
Ritor1
parents:
diff changeset
5693 this->SetCondition(Condition_Cursed, 1);
Ritor1
parents:
diff changeset
5694 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5695 return;
Ritor1
parents:
diff changeset
5696 case VAR_Weak:
Ritor1
parents:
diff changeset
5697 this->SetCondition(Condition_Weak, 1);
Ritor1
parents:
diff changeset
5698 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5699 return;
Ritor1
parents:
diff changeset
5700 case VAR_Asleep:
Ritor1
parents:
diff changeset
5701 this->SetCondition(Condition_Sleep, 1);
Ritor1
parents:
diff changeset
5702 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5703 return;
Ritor1
parents:
diff changeset
5704 case VAR_Afraid:
Ritor1
parents:
diff changeset
5705 this->SetCondition(Condition_Fear, 1);
Ritor1
parents:
diff changeset
5706 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5707 return;
Ritor1
parents:
diff changeset
5708 case VAR_Drunk:
Ritor1
parents:
diff changeset
5709 this->SetCondition(Condition_Drunk, 1);
Ritor1
parents:
diff changeset
5710 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5711 return;
Ritor1
parents:
diff changeset
5712 case VAR_Insane:
Ritor1
parents:
diff changeset
5713 this->SetCondition(Condition_Insane, 1);
Ritor1
parents:
diff changeset
5714 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5715 return;
Ritor1
parents:
diff changeset
5716 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
5717 this->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
5718 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5719 return;
Ritor1
parents:
diff changeset
5720 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
5721 this->SetCondition(Condition_Disease_Weak, 1);
Ritor1
parents:
diff changeset
5722 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5723 return;
Ritor1
parents:
diff changeset
5724 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
5725 this->SetCondition(Condition_Poison_Medium, 1);
Ritor1
parents:
diff changeset
5726 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5727 return;
Ritor1
parents:
diff changeset
5728 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
5729 this->SetCondition(Condition_Disease_Medium, 1);
Ritor1
parents:
diff changeset
5730 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5731 return;
Ritor1
parents:
diff changeset
5732 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
5733 this->SetCondition(Condition_Poison_Severe, 1);
Ritor1
parents:
diff changeset
5734 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5735 return;
Ritor1
parents:
diff changeset
5736 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
5737 this->SetCondition(Condition_Disease_Severe, 1);
Ritor1
parents:
diff changeset
5738 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5739 return;
Ritor1
parents:
diff changeset
5740 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
5741 this->SetCondition(Condition_Paralyzed, 1);
Ritor1
parents:
diff changeset
5742 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5743 return;
Ritor1
parents:
diff changeset
5744 case VAR_Unconsious:
Ritor1
parents:
diff changeset
5745 this->SetCondition(Condition_Unconcious, 1);
Ritor1
parents:
diff changeset
5746 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5747 return;
Ritor1
parents:
diff changeset
5748 case VAR_Dead:
Ritor1
parents:
diff changeset
5749 this->SetCondition(Condition_Dead, 1);
Ritor1
parents:
diff changeset
5750 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5751 return;
Ritor1
parents:
diff changeset
5752 case VAR_Stoned:
Ritor1
parents:
diff changeset
5753 this->SetCondition(Condition_Pertified, 1);
Ritor1
parents:
diff changeset
5754 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5755 return;
Ritor1
parents:
diff changeset
5756 case VAR_Eradicated:
Ritor1
parents:
diff changeset
5757 this->SetCondition(Condition_Eradicated, 1);
Ritor1
parents:
diff changeset
5758 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5759 return;
Ritor1
parents:
diff changeset
5760 case VAR_MajorCondition:
Ritor1
parents:
diff changeset
5761 pConditions.fill(0);
Ritor1
parents:
diff changeset
5762 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5763 return;
Ritor1
parents:
diff changeset
5764 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
5765 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText )
Ritor1
parents:
diff changeset
5766 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5767 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
5768 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
5769 bFlashAutonotesBook = 1;
Ritor1
parents:
diff changeset
5770 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
Ritor1
parents:
diff changeset
5771 }
Ritor1
parents:
diff changeset
5772 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
Ritor1
parents:
diff changeset
5773 PlayAwardSound();
Ritor1
parents:
diff changeset
5774 return;
Ritor1
parents:
diff changeset
5775 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
5776 _449B7E_toggle_bit((unsigned char *)playerEventBits, var_value, 1u);
Ritor1
parents:
diff changeset
5777 return;
Ritor1
parents:
diff changeset
5778 case VAR_NPCs2:
Ritor1
parents:
diff changeset
5779 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
5780 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
Ritor1
parents:
diff changeset
5781 pParty->CountHirelings();
Ritor1
parents:
diff changeset
5782 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
5783 return;
Ritor1
parents:
diff changeset
5784 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
5785 this->uSkillPoints = var_value;
Ritor1
parents:
diff changeset
5786 return;
Ritor1
parents:
diff changeset
5787 case VAR_Counter1:
Ritor1
parents:
diff changeset
5788 case VAR_Counter2:
Ritor1
parents:
diff changeset
5789 case VAR_Counter3:
Ritor1
parents:
diff changeset
5790 case VAR_Counter4:
Ritor1
parents:
diff changeset
5791 case VAR_Counter5:
Ritor1
parents:
diff changeset
5792 case VAR_Counter6:
Ritor1
parents:
diff changeset
5793 case VAR_Counter7:
Ritor1
parents:
diff changeset
5794 case VAR_Counter8:
Ritor1
parents:
diff changeset
5795 case VAR_Counter9:
Ritor1
parents:
diff changeset
5796 case VAR_Counter10:
Ritor1
parents:
diff changeset
5797 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; // *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
Ritor1
parents:
diff changeset
5798 return;
Ritor1
parents:
diff changeset
5799 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
5800 v24 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
5801 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
5802 v24 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
5803 v24->uReputation = var_value;
Ritor1
parents:
diff changeset
5804 if ( var_value > 10000 )
Ritor1
parents:
diff changeset
5805 v24->uReputation = 10000;
Ritor1
parents:
diff changeset
5806 return;
Ritor1
parents:
diff changeset
5807 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
5808 pParty->uNumGoldInBank = var_value;
Ritor1
parents:
diff changeset
5809 return;
Ritor1
parents:
diff changeset
5810 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
5811 pParty->uNumDeaths = var_value;
Ritor1
parents:
diff changeset
5812 return;
Ritor1
parents:
diff changeset
5813 case VAR_NumBounties:
Ritor1
parents:
diff changeset
5814 pParty->uNumBountiesCollected = var_value;
Ritor1
parents:
diff changeset
5815 return;
Ritor1
parents:
diff changeset
5816 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
5817 pParty->uNumPrisonTerms = var_value;
Ritor1
parents:
diff changeset
5818 return;
Ritor1
parents:
diff changeset
5819 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
5820 pParty->uNumArenaPageWins = var_value;
Ritor1
parents:
diff changeset
5821 return;
Ritor1
parents:
diff changeset
5822 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
5823 pParty->uNumArenaSquireWins = var_value;
Ritor1
parents:
diff changeset
5824 return;
Ritor1
parents:
diff changeset
5825 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
5826 pParty->uNumArenaKnightWins = var_value;
Ritor1
parents:
diff changeset
5827 return;
Ritor1
parents:
diff changeset
5828 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
5829 pParty->uNumArenaLordWins = var_value;
Ritor1
parents:
diff changeset
5830 return;
Ritor1
parents:
diff changeset
5831 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
5832 SetSkillByEvent(&Player::skillStaff, var_value);
Ritor1
parents:
diff changeset
5833 return;
Ritor1
parents:
diff changeset
5834 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
5835 SetSkillByEvent(&Player::skillSword, var_value);
Ritor1
parents:
diff changeset
5836 return;
Ritor1
parents:
diff changeset
5837 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
5838 SetSkillByEvent(&Player::skillDagger, var_value);
Ritor1
parents:
diff changeset
5839 return;
Ritor1
parents:
diff changeset
5840 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
5841 SetSkillByEvent(&Player::skillAxe, var_value);
Ritor1
parents:
diff changeset
5842 return;
Ritor1
parents:
diff changeset
5843 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
5844 SetSkillByEvent(&Player::skillSpear, var_value);
Ritor1
parents:
diff changeset
5845 return;
Ritor1
parents:
diff changeset
5846 case VAR_BowSkill:
Ritor1
parents:
diff changeset
5847 SetSkillByEvent(&Player::skillBow, var_value);
Ritor1
parents:
diff changeset
5848 return;
Ritor1
parents:
diff changeset
5849 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
5850 SetSkillByEvent(&Player::skillMace, var_value);
Ritor1
parents:
diff changeset
5851 return;
Ritor1
parents:
diff changeset
5852 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
5853 SetSkillByEvent(&Player::skillBlaster, var_value);
Ritor1
parents:
diff changeset
5854 return;
Ritor1
parents:
diff changeset
5855 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
5856 SetSkillByEvent(&Player::skillShield, var_value);
Ritor1
parents:
diff changeset
5857 return;
Ritor1
parents:
diff changeset
5858 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
5859 SetSkillByEvent(&Player::skillLeather, var_value);
Ritor1
parents:
diff changeset
5860 return;
Ritor1
parents:
diff changeset
5861 case VAR_SkillChain:
Ritor1
parents:
diff changeset
5862 SetSkillByEvent(&Player::skillChain, var_value);
Ritor1
parents:
diff changeset
5863 return;
Ritor1
parents:
diff changeset
5864 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
5865 SetSkillByEvent(&Player::skillPlate, var_value);
Ritor1
parents:
diff changeset
5866 return;
Ritor1
parents:
diff changeset
5867 case VAR_FireSkill:
Ritor1
parents:
diff changeset
5868 SetSkillByEvent(&Player::skillFire, var_value);
Ritor1
parents:
diff changeset
5869 return;
Ritor1
parents:
diff changeset
5870 case VAR_AirSkill:
Ritor1
parents:
diff changeset
5871 SetSkillByEvent(&Player::skillAir, var_value);
Ritor1
parents:
diff changeset
5872 return;
Ritor1
parents:
diff changeset
5873 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
5874 SetSkillByEvent(&Player::skillWater, var_value);
Ritor1
parents:
diff changeset
5875 return;
Ritor1
parents:
diff changeset
5876 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
5877 SetSkillByEvent(&Player::skillEarth, var_value);
Ritor1
parents:
diff changeset
5878 return;
Ritor1
parents:
diff changeset
5879 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
5880 SetSkillByEvent(&Player::skillSpirit, var_value);
Ritor1
parents:
diff changeset
5881 return;
Ritor1
parents:
diff changeset
5882 case VAR_MindSkill:
Ritor1
parents:
diff changeset
5883 SetSkillByEvent(&Player::skillMind, var_value);
Ritor1
parents:
diff changeset
5884 return;
Ritor1
parents:
diff changeset
5885 case VAR_BodySkill:
Ritor1
parents:
diff changeset
5886 SetSkillByEvent(&Player::skillBody, var_value);
Ritor1
parents:
diff changeset
5887 return;
Ritor1
parents:
diff changeset
5888 case VAR_LightSkill:
Ritor1
parents:
diff changeset
5889 SetSkillByEvent(&Player::skillLight, var_value);
Ritor1
parents:
diff changeset
5890 return;
Ritor1
parents:
diff changeset
5891 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
5892 SetSkillByEvent(&Player::skillDark, var_value);
Ritor1
parents:
diff changeset
5893 return;
Ritor1
parents:
diff changeset
5894 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
5895 SetSkillByEvent(&Player::skillItemId, var_value);
Ritor1
parents:
diff changeset
5896 return;
Ritor1
parents:
diff changeset
5897 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
5898 SetSkillByEvent(&Player::skillMerchant, var_value);
Ritor1
parents:
diff changeset
5899 return;
Ritor1
parents:
diff changeset
5900 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
5901 SetSkillByEvent(&Player::skillRepair, var_value);
Ritor1
parents:
diff changeset
5902 return;
Ritor1
parents:
diff changeset
5903 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
5904 SetSkillByEvent(&Player::skillBodybuilding, var_value);
Ritor1
parents:
diff changeset
5905 return;
Ritor1
parents:
diff changeset
5906 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
5907 SetSkillByEvent(&Player::skillMeditation, var_value);
Ritor1
parents:
diff changeset
5908 return;
Ritor1
parents:
diff changeset
5909 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
5910 SetSkillByEvent(&Player::skillPerception, var_value);
Ritor1
parents:
diff changeset
5911 return;
Ritor1
parents:
diff changeset
5912 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
5913 SetSkillByEvent(&Player::skillDiplomacy, var_value);
Ritor1
parents:
diff changeset
5914 return;
Ritor1
parents:
diff changeset
5915 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
5916 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
5917 return;
Ritor1
parents:
diff changeset
5918 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
5919 SetSkillByEvent(&Player::skillDisarmTrap, var_value);
Ritor1
parents:
diff changeset
5920 return;
Ritor1
parents:
diff changeset
5921 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
5922 SetSkillByEvent(&Player::skillDodge, var_value);
Ritor1
parents:
diff changeset
5923 return;
Ritor1
parents:
diff changeset
5924 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
5925 SetSkillByEvent(&Player::skillUnarmed, var_value);
Ritor1
parents:
diff changeset
5926 return;
Ritor1
parents:
diff changeset
5927 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
5928 SetSkillByEvent(&Player::skillMonsterId, var_value);
Ritor1
parents:
diff changeset
5929 return;
Ritor1
parents:
diff changeset
5930 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
5931 SetSkillByEvent(&Player::skillArmsmaster, var_value);
Ritor1
parents:
diff changeset
5932 return;
Ritor1
parents:
diff changeset
5933 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
5934 SetSkillByEvent(&Player::skillStealing, var_value);
Ritor1
parents:
diff changeset
5935 return;
Ritor1
parents:
diff changeset
5936 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
5937 SetSkillByEvent(&Player::skillAlchemy, var_value);
Ritor1
parents:
diff changeset
5938 return;
Ritor1
parents:
diff changeset
5939 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
5940 SetSkillByEvent(&Player::skillLearning, var_value);
Ritor1
parents:
diff changeset
5941 return;
Ritor1
parents:
diff changeset
5942 }
Ritor1
parents:
diff changeset
5943 }
Ritor1
parents:
diff changeset
5944
Ritor1
parents:
diff changeset
5945
Ritor1
parents:
diff changeset
5946 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5947 void Player::PlayAwardSound()
Ritor1
parents:
diff changeset
5948 {
Ritor1
parents:
diff changeset
5949 int playerIndex = GetPlayerIndex();
Ritor1
parents:
diff changeset
5950 signed int v25 = 8 * playerIndex + 400;
Ritor1
parents:
diff changeset
5951 LOBYTE(v25) = PID(OBJECT_Player,playerIndex - 112);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
5952 pAudioPlayer->PlaySound(SOUND_quest, v25, 0, -1, 0, 0, 0, 0);
2498
Ritor1
parents:
diff changeset
5953 }
Ritor1
parents:
diff changeset
5954
Ritor1
parents:
diff changeset
5955 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5956 void Player::PlayAwardSound_Anim()
Ritor1
parents:
diff changeset
5957 {
Ritor1
parents:
diff changeset
5958 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5959 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
2498
Ritor1
parents:
diff changeset
5960 PlayAwardSound();
Ritor1
parents:
diff changeset
5961 }
Ritor1
parents:
diff changeset
5962
Ritor1
parents:
diff changeset
5963 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5964 void Player::PlayAwardSound_Anim_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
5965 {
Ritor1
parents:
diff changeset
5966 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
5967 PlayAwardSound_Anim();
Ritor1
parents:
diff changeset
5968 }
Ritor1
parents:
diff changeset
5969
Ritor1
parents:
diff changeset
5970 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
5971 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 skillValue )
Ritor1
parents:
diff changeset
5972 {
Ritor1
parents:
diff changeset
5973 unsigned __int16 currSkillValue = this->*skillToSet;
Ritor1
parents:
diff changeset
5974 if ( skillValue > 63 ) //the original had the condition reversed which was probably wrong
Ritor1
parents:
diff changeset
5975 {
Ritor1
parents:
diff changeset
5976 this->*skillToSet = skillValue | currSkillValue & 63;
Ritor1
parents:
diff changeset
5977 }
Ritor1
parents:
diff changeset
5978 else
Ritor1
parents:
diff changeset
5979 {
Ritor1
parents:
diff changeset
5980 this->*skillToSet = skillValue | currSkillValue & 0xC0;
Ritor1
parents:
diff changeset
5981 }
Ritor1
parents:
diff changeset
5982 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
5983 pEngine->pStru6Instance->SetPlayerBuffAnim(0x96u, playerIndex);
2498
Ritor1
parents:
diff changeset
5984 PlayAwardSound();
Ritor1
parents:
diff changeset
5985 }
Ritor1
parents:
diff changeset
5986
Ritor1
parents:
diff changeset
5987 //----- (0044AFFB) --------------------------------------------------------
Ritor1
parents:
diff changeset
5988 void Player::AddVariable(enum VariableType var_type, signed int val)
Ritor1
parents:
diff changeset
5989 {
Ritor1
parents:
diff changeset
5990 int v6; // eax@15
Ritor1
parents:
diff changeset
5991 unsigned int v7; // esi@18
Ritor1
parents:
diff changeset
5992 DDM_DLV_Header *v27; // eax@153
Ritor1
parents:
diff changeset
5993 ItemGen item; // [sp+Ch] [bp-2Ch]@45
Ritor1
parents:
diff changeset
5994
Ritor1
parents:
diff changeset
5995 if ( var_type >= VAR_Counter1 && var_type <= VAR_Counter10)
Ritor1
parents:
diff changeset
5996 {
Ritor1
parents:
diff changeset
5997 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
5998 return;
Ritor1
parents:
diff changeset
5999 }
Ritor1
parents:
diff changeset
6000
Ritor1
parents:
diff changeset
6001 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
Ritor1
parents:
diff changeset
6002 {
Ritor1
parents:
diff changeset
6003 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
6004 PlayAwardSound();
Ritor1
parents:
diff changeset
6005 return;
Ritor1
parents:
diff changeset
6006 }
Ritor1
parents:
diff changeset
6007
Ritor1
parents:
diff changeset
6008 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6009 {
Ritor1
parents:
diff changeset
6010
Ritor1
parents:
diff changeset
6011 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
6012 {
Ritor1
parents:
diff changeset
6013 if (255 - val > stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0])
Ritor1
parents:
diff changeset
6014 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] += val;
Ritor1
parents:
diff changeset
6015 else
Ritor1
parents:
diff changeset
6016 stru_5E4C90_MapPersistVars.field_0[var_type - VAR_MapPersistentVariable_0] = 255;
Ritor1
parents:
diff changeset
6017 }
Ritor1
parents:
diff changeset
6018 if ( (signed int)var_type >= VAR_MapPersistentVariable_75 && var_type <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6019 {
Ritor1
parents:
diff changeset
6020 if (255 - val > stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75])
Ritor1
parents:
diff changeset
6021 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] += val;
Ritor1
parents:
diff changeset
6022 else
Ritor1
parents:
diff changeset
6023 stru_5E4C90_MapPersistVars._decor_events[var_type - VAR_MapPersistentVariable_75] = 255;
Ritor1
parents:
diff changeset
6024 }
Ritor1
parents:
diff changeset
6025 return;
Ritor1
parents:
diff changeset
6026 }
Ritor1
parents:
diff changeset
6027
Ritor1
parents:
diff changeset
6028 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
Ritor1
parents:
diff changeset
6029 {
Ritor1
parents:
diff changeset
6030 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
Ritor1
parents:
diff changeset
6031 {
Ritor1
parents:
diff changeset
6032 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
Ritor1
parents:
diff changeset
6033 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText = 0)
Ritor1
parents:
diff changeset
6034 {
Ritor1
parents:
diff changeset
6035 bFlashHistoryBook = 1;
Ritor1
parents:
diff changeset
6036 PlayAwardSound();
Ritor1
parents:
diff changeset
6037 }
Ritor1
parents:
diff changeset
6038 }
Ritor1
parents:
diff changeset
6039 return;
Ritor1
parents:
diff changeset
6040 }
Ritor1
parents:
diff changeset
6041
Ritor1
parents:
diff changeset
6042 switch ( var_type )
Ritor1
parents:
diff changeset
6043 {
Ritor1
parents:
diff changeset
6044 case VAR_RandomGold:
Ritor1
parents:
diff changeset
6045 if ( val == 0 )
Ritor1
parents:
diff changeset
6046 val = 1;
Ritor1
parents:
diff changeset
6047 v6 = rand();
Ritor1
parents:
diff changeset
6048 pParty->PartyFindsGold(v6 % val + 1, 1);
Ritor1
parents:
diff changeset
6049 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6050 return;
Ritor1
parents:
diff changeset
6051 case VAR_RandomFood:
Ritor1
parents:
diff changeset
6052 if ( val == 0 )
Ritor1
parents:
diff changeset
6053 val = 1;
Ritor1
parents:
diff changeset
6054 v7 = rand() % val + 1;
Ritor1
parents:
diff changeset
6055 Party::GiveFood(v7);
Ritor1
parents:
diff changeset
6056 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
Ritor1
parents:
diff changeset
6057 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6058 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6059 PlayAwardSound();
Ritor1
parents:
diff changeset
6060 return;
Ritor1
parents:
diff changeset
6061 case VAR_Sex:
Ritor1
parents:
diff changeset
6062 this->uSex = (PLAYER_SEX)val;
Ritor1
parents:
diff changeset
6063 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6064 return;
Ritor1
parents:
diff changeset
6065 case VAR_Class:
Ritor1
parents:
diff changeset
6066 this->classType = (PLAYER_CLASS_TYPE)val;
Ritor1
parents:
diff changeset
6067 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6068 return;
Ritor1
parents:
diff changeset
6069 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
6070 this->sHealth = min(this->sHealth + val, this->GetMaxHealth() );
Ritor1
parents:
diff changeset
6071 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6072 return;
Ritor1
parents:
diff changeset
6073 case VAR_MaxHP:
Ritor1
parents:
diff changeset
6074 this->_health_related = 0;
Ritor1
parents:
diff changeset
6075 this->uFullHealthBonus = 0;
Ritor1
parents:
diff changeset
6076 this->sHealth = this->GetMaxHealth();
Ritor1
parents:
diff changeset
6077 return;
Ritor1
parents:
diff changeset
6078 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
6079 this->sMana = min(this->sMana + val, this->GetMaxMana() );
Ritor1
parents:
diff changeset
6080 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6081 return;
Ritor1
parents:
diff changeset
6082 case VAR_MaxSP:
Ritor1
parents:
diff changeset
6083 this->_mana_related = 0;
Ritor1
parents:
diff changeset
6084 this->uFullManaBonus = 0;
Ritor1
parents:
diff changeset
6085 this->sMana = GetMaxMana();
Ritor1
parents:
diff changeset
6086 return;
Ritor1
parents:
diff changeset
6087 case VAR_ACModifier:
Ritor1
parents:
diff changeset
6088 this->sACModifier = min(this->sACModifier + val, 255);
Ritor1
parents:
diff changeset
6089 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6090 return;
Ritor1
parents:
diff changeset
6091 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
6092 this->uLevel = min(this->uLevel + val, 255);
Ritor1
parents:
diff changeset
6093 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6094 return;
Ritor1
parents:
diff changeset
6095 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
6096 this->sLevelModifier = min(this->sLevelModifier + val, 255);
Ritor1
parents:
diff changeset
6097 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6098 return;
Ritor1
parents:
diff changeset
6099 case VAR_Age:
Ritor1
parents:
diff changeset
6100 this->sAgeModifier += val;
Ritor1
parents:
diff changeset
6101 return;
Ritor1
parents:
diff changeset
6102 case VAR_Award:
Ritor1
parents:
diff changeset
6103 if (_449B57_test_bit(this->_achieved_awards_bits, val) && pAwards[val].pText )
Ritor1
parents:
diff changeset
6104 {
Ritor1
parents:
diff changeset
6105 PlayAwardSound_Anim97_Face(SPEECH_96);
Ritor1
parents:
diff changeset
6106 }
Ritor1
parents:
diff changeset
6107 _449B7E_toggle_bit(this->_achieved_awards_bits, val, 1);
Ritor1
parents:
diff changeset
6108 return;
Ritor1
parents:
diff changeset
6109 case VAR_Experience:
Ritor1
parents:
diff changeset
6110 this->uExperience = min(this->uExperience + val, 4000000000i64);
Ritor1
parents:
diff changeset
6111 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6112 return;
Ritor1
parents:
diff changeset
6113 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
6114 if ( !_449B57_test_bit(pParty->_quest_bits, val) && pQuestTable[val] )
Ritor1
parents:
diff changeset
6115 {
Ritor1
parents:
diff changeset
6116 bFlashQuestBook = 1;
Ritor1
parents:
diff changeset
6117 PlayAwardSound_Anim97_Face(SPEECH_93);
Ritor1
parents:
diff changeset
6118 }
Ritor1
parents:
diff changeset
6119 _449B7E_toggle_bit(pParty->_quest_bits, val, 1);
Ritor1
parents:
diff changeset
6120 return;
Ritor1
parents:
diff changeset
6121 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
6122 item.Reset();
Ritor1
parents:
diff changeset
6123 item.uAttributes = 1;
Ritor1
parents:
diff changeset
6124 item.uItemID = val;
Ritor1
parents:
diff changeset
6125 if ( val >= ITEM_ARTIFACT_PUCK && val <= ITEM_RELIC_MEKORIGS_HAMMER )
Ritor1
parents:
diff changeset
6126 pParty->pIsArtifactFound[val-500] = 1;
Ritor1
parents:
diff changeset
6127 else if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION )
Ritor1
parents:
diff changeset
6128 {
Ritor1
parents:
diff changeset
6129 item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1;
Ritor1
parents:
diff changeset
6130 item.uMaxCharges = LOBYTE(item.uNumCharges);
Ritor1
parents:
diff changeset
6131 }
Ritor1
parents:
diff changeset
6132 pParty->SetHoldingItem(&item);
Ritor1
parents:
diff changeset
6133 return;
Ritor1
parents:
diff changeset
6134 case VAR_FixedGold:
Ritor1
parents:
diff changeset
6135 pParty->PartyFindsGold(val, 1);
Ritor1
parents:
diff changeset
6136 return;
Ritor1
parents:
diff changeset
6137 case VAR_BaseMight:
Ritor1
parents:
diff changeset
6138 this->uMight = min(this->uMight + val, 255);
Ritor1
parents:
diff changeset
6139 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6140 return;
Ritor1
parents:
diff changeset
6141 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
6142 this->uIntelligence = min(this->uIntelligence + val, 255);
Ritor1
parents:
diff changeset
6143 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6144 return;
Ritor1
parents:
diff changeset
6145 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
6146 this->uWillpower = min(this->uWillpower + val, 255);
Ritor1
parents:
diff changeset
6147 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6148 return;
Ritor1
parents:
diff changeset
6149 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
6150 this->uEndurance = min(this->uEndurance + val, 255);
Ritor1
parents:
diff changeset
6151 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6152 return;
Ritor1
parents:
diff changeset
6153 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
6154 this->uSpeed = min(this->uSpeed + val, 255);
Ritor1
parents:
diff changeset
6155 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6156 return;
Ritor1
parents:
diff changeset
6157 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
6158 this->uAccuracy = min(this->uAccuracy + val, 255);
Ritor1
parents:
diff changeset
6159 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6160 return;
Ritor1
parents:
diff changeset
6161 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
6162 this->uLuck = min(this->uLuck + val, 255);
Ritor1
parents:
diff changeset
6163 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6164 return;
Ritor1
parents:
diff changeset
6165 case VAR_FixedFood:
Ritor1
parents:
diff changeset
6166 Party::GiveFood(val);
Ritor1
parents:
diff changeset
6167 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
Ritor1
parents:
diff changeset
6168 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6169 if ( pParty->uNumFoodRations > 0xFFFF )
Ritor1
parents:
diff changeset
6170 Party::SetFood(0xFFFFu);
Ritor1
parents:
diff changeset
6171 PlayAwardSound();
Ritor1
parents:
diff changeset
6172 return;
Ritor1
parents:
diff changeset
6173 case VAR_MightBonus:
Ritor1
parents:
diff changeset
6174 case VAR_ActualMight:
Ritor1
parents:
diff changeset
6175 this->uMightBonus = min(this->uMightBonus + val, 255);
Ritor1
parents:
diff changeset
6176 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6177 return;
Ritor1
parents:
diff changeset
6178 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
6179 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
6180 this->uIntelligenceBonus = min(this->uIntelligenceBonus + val, 255);
Ritor1
parents:
diff changeset
6181 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6182 return;
Ritor1
parents:
diff changeset
6183 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
6184 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
6185 this->uWillpowerBonus = min(this->uWillpowerBonus + val, 255);
Ritor1
parents:
diff changeset
6186 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6187 return;
Ritor1
parents:
diff changeset
6188 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
6189 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
6190 this->uEnduranceBonus = min(this->uEnduranceBonus + val, 255);
Ritor1
parents:
diff changeset
6191 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6192 return;
Ritor1
parents:
diff changeset
6193 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
6194 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
6195 this->uSpeedBonus = min(this->uSpeedBonus + val, 255);
Ritor1
parents:
diff changeset
6196 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6197 return;
Ritor1
parents:
diff changeset
6198 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
6199 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
6200 this->uAccuracyBonus = min(this->uAccuracyBonus + val, 255);
Ritor1
parents:
diff changeset
6201 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6202 return;
Ritor1
parents:
diff changeset
6203 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
6204 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
6205 this->uLuckBonus = min(this->uLuckBonus + val, 255);
Ritor1
parents:
diff changeset
6206 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6207 return;
Ritor1
parents:
diff changeset
6208 case VAR_FireResistance:
Ritor1
parents:
diff changeset
6209 this->sResFireBase = min(this->sResFireBase + val, 255);
Ritor1
parents:
diff changeset
6210 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6211 return;
Ritor1
parents:
diff changeset
6212 case VAR_AirResistance:
Ritor1
parents:
diff changeset
6213 this->sResAirBase = min(this->sResAirBase + val, 255);
Ritor1
parents:
diff changeset
6214 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6215 return;
Ritor1
parents:
diff changeset
6216 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
6217 this->sResWaterBase = min(this->sResWaterBase + val, 255);
Ritor1
parents:
diff changeset
6218 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6219 return;
Ritor1
parents:
diff changeset
6220 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
6221 this->sResEarthBase = min(this->sResEarthBase + val, 255);
Ritor1
parents:
diff changeset
6222 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6223 return;
Ritor1
parents:
diff changeset
6224 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
6225 this->sResSpiritBase = min(this->sResSpiritBase + val, 255);
Ritor1
parents:
diff changeset
6226 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6227 return;
Ritor1
parents:
diff changeset
6228 case VAR_MindResistance:
Ritor1
parents:
diff changeset
6229 this->sResMindBase = min(this->sResMindBase + val, 255);
Ritor1
parents:
diff changeset
6230 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6231 return;
Ritor1
parents:
diff changeset
6232 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
6233 this->sResBodyBase = min(this->sResBodyBase + val, 255);
Ritor1
parents:
diff changeset
6234 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6235 return;
Ritor1
parents:
diff changeset
6236 case VAR_LightResistance:
Ritor1
parents:
diff changeset
6237 this->sResLightBase = min(this->sResLightBase + val, 255);
Ritor1
parents:
diff changeset
6238 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6239 return;
Ritor1
parents:
diff changeset
6240 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
6241 this->sResDarkBase = min(this->sResDarkBase + val, 255);
Ritor1
parents:
diff changeset
6242 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6243 return;
Ritor1
parents:
diff changeset
6244 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
6245 this->sResMagicBase = min(this->sResMagicBase + val, 255);
Ritor1
parents:
diff changeset
6246 PlayAwardSound_Anim97_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6247 return;
Ritor1
parents:
diff changeset
6248 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
6249 this->sResFireBonus = min(this->sResFireBonus + val, 255);
Ritor1
parents:
diff changeset
6250 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6251 return;
Ritor1
parents:
diff changeset
6252 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
6253 this->sResAirBonus = min(this->sResAirBonus + val, 255);
Ritor1
parents:
diff changeset
6254 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6255 return;
Ritor1
parents:
diff changeset
6256 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
6257 this->sResWaterBonus = min(this->sResWaterBonus + val, 255);
Ritor1
parents:
diff changeset
6258 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6259 return;
Ritor1
parents:
diff changeset
6260 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
6261 this->sResEarthBonus = min(this->sResEarthBonus + val, 255);
Ritor1
parents:
diff changeset
6262 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6263 return;
Ritor1
parents:
diff changeset
6264 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
6265 this->sResSpiritBonus = min(this->sResSpiritBonus + val, 255);
Ritor1
parents:
diff changeset
6266 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6267 return;
Ritor1
parents:
diff changeset
6268 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
6269 this->sResMindBonus = min(this->sResMindBonus + val, 255);
Ritor1
parents:
diff changeset
6270 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6271 return;
Ritor1
parents:
diff changeset
6272 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
6273 this->sResBodyBonus = min(this->sResBodyBonus + val, 255);
Ritor1
parents:
diff changeset
6274 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6275 return;
Ritor1
parents:
diff changeset
6276 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
6277 this->sResLightBonus = min(this->sResLightBonus + val, 255);
Ritor1
parents:
diff changeset
6278 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6279 return;
Ritor1
parents:
diff changeset
6280 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
6281 this->sResDarkBonus = min(this->sResDarkBonus + val, 255);
Ritor1
parents:
diff changeset
6282 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6283 return;
Ritor1
parents:
diff changeset
6284 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
6285 this->sResMagicBonus = min(this->sResMagicBonus + val, 255);
Ritor1
parents:
diff changeset
6286 PlayAwardSound_Anim97_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6287 return;
Ritor1
parents:
diff changeset
6288 case VAR_Cursed:
Ritor1
parents:
diff changeset
6289 this->SetCondition(Condition_Cursed, 1);
Ritor1
parents:
diff changeset
6290 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6291 return;
Ritor1
parents:
diff changeset
6292 case VAR_Weak:
Ritor1
parents:
diff changeset
6293 this->SetCondition(Condition_Weak, 1);
Ritor1
parents:
diff changeset
6294 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6295 return;
Ritor1
parents:
diff changeset
6296 case VAR_Asleep:
Ritor1
parents:
diff changeset
6297 this->SetCondition(Condition_Sleep, 1);
Ritor1
parents:
diff changeset
6298 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6299 return;
Ritor1
parents:
diff changeset
6300 case VAR_Afraid:
Ritor1
parents:
diff changeset
6301 this->SetCondition(Condition_Fear, 1);
Ritor1
parents:
diff changeset
6302 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6303 return;
Ritor1
parents:
diff changeset
6304 case VAR_Drunk:
Ritor1
parents:
diff changeset
6305 this->SetCondition(Condition_Drunk, 1);
Ritor1
parents:
diff changeset
6306 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6307 return;
Ritor1
parents:
diff changeset
6308 case VAR_Insane:
Ritor1
parents:
diff changeset
6309 this->SetCondition(Condition_Insane, 1);
Ritor1
parents:
diff changeset
6310 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6311 return;
Ritor1
parents:
diff changeset
6312 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
6313 this->SetCondition(Condition_Poison_Weak, 1);
Ritor1
parents:
diff changeset
6314 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6315 return;
Ritor1
parents:
diff changeset
6316 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
6317 this->SetCondition(Condition_Disease_Weak, 1);
Ritor1
parents:
diff changeset
6318 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6319 return;
Ritor1
parents:
diff changeset
6320 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
6321 this->SetCondition(Condition_Poison_Medium, 1);
Ritor1
parents:
diff changeset
6322 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6323 return;
Ritor1
parents:
diff changeset
6324 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
6325 this->SetCondition(Condition_Disease_Medium, 1);
Ritor1
parents:
diff changeset
6326 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6327 return;
Ritor1
parents:
diff changeset
6328 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
6329 this->SetCondition(Condition_Poison_Severe, 1);
Ritor1
parents:
diff changeset
6330 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6331 return;
Ritor1
parents:
diff changeset
6332 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
6333 this->SetCondition(Condition_Disease_Severe, 1);
Ritor1
parents:
diff changeset
6334 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6335 return;
Ritor1
parents:
diff changeset
6336 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
6337 this->SetCondition(Condition_Paralyzed, 1);
Ritor1
parents:
diff changeset
6338 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6339 return;
Ritor1
parents:
diff changeset
6340 case VAR_Unconsious:
Ritor1
parents:
diff changeset
6341 this->SetCondition(Condition_Unconcious, 1);
Ritor1
parents:
diff changeset
6342 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6343 return;
Ritor1
parents:
diff changeset
6344 case VAR_Dead:
Ritor1
parents:
diff changeset
6345 this->SetCondition(Condition_Dead, 1);
Ritor1
parents:
diff changeset
6346 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6347 return;
Ritor1
parents:
diff changeset
6348 case VAR_Stoned:
Ritor1
parents:
diff changeset
6349 this->SetCondition(Condition_Pertified, 1);
Ritor1
parents:
diff changeset
6350 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6351 return;
Ritor1
parents:
diff changeset
6352 case VAR_Eradicated:
Ritor1
parents:
diff changeset
6353 this->SetCondition(Condition_Eradicated, 1);
Ritor1
parents:
diff changeset
6354 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6355 return;
Ritor1
parents:
diff changeset
6356 case VAR_MajorCondition :
Ritor1
parents:
diff changeset
6357 pConditions.fill(0);
Ritor1
parents:
diff changeset
6358 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6359 return;
Ritor1
parents:
diff changeset
6360 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
6361 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
Ritor1
parents:
diff changeset
6362 {
Ritor1
parents:
diff changeset
6363 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
6364 bFlashAutonotesBook = 1;
Ritor1
parents:
diff changeset
6365 _506568_autonote_type = pAutonoteTxt[val].eType;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6366 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, GetPlayerIndex());
2498
Ritor1
parents:
diff changeset
6367 }
Ritor1
parents:
diff changeset
6368 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1);
Ritor1
parents:
diff changeset
6369 PlayAwardSound();
Ritor1
parents:
diff changeset
6370 return;
Ritor1
parents:
diff changeset
6371 case VAR_PlayerBits:
Ritor1
parents:
diff changeset
6372 _449B7E_toggle_bit((unsigned char *)this->playerEventBits, val, 1u);
Ritor1
parents:
diff changeset
6373 return;
Ritor1
parents:
diff changeset
6374 case VAR_NPCs2:
Ritor1
parents:
diff changeset
6375 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
6376 LOBYTE(pNPCStats->pNewNPCData[val].uFlags) |= 0x80u;
Ritor1
parents:
diff changeset
6377 pParty->CountHirelings();
Ritor1
parents:
diff changeset
6378 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
6379 return;
Ritor1
parents:
diff changeset
6380 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
6381 this->uSkillPoints += val;
Ritor1
parents:
diff changeset
6382 return;
Ritor1
parents:
diff changeset
6383 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
6384 v27 = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
6385 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
6386 v27 = &pIndoor->dlv;
Ritor1
parents:
diff changeset
6387 v27->uReputation += val;
Ritor1
parents:
diff changeset
6388 if ( v27->uReputation > 10000 )
Ritor1
parents:
diff changeset
6389 v27->uReputation = 10000;
Ritor1
parents:
diff changeset
6390 return;
Ritor1
parents:
diff changeset
6391 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
6392 pParty->uNumGoldInBank += val;
Ritor1
parents:
diff changeset
6393 return;
Ritor1
parents:
diff changeset
6394 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
6395 pParty->uNumDeaths += val;
Ritor1
parents:
diff changeset
6396 return;
Ritor1
parents:
diff changeset
6397 case VAR_NumBounties:
Ritor1
parents:
diff changeset
6398 pParty->uNumBountiesCollected += val;
Ritor1
parents:
diff changeset
6399 return;
Ritor1
parents:
diff changeset
6400 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
6401 pParty->uNumPrisonTerms += val;
Ritor1
parents:
diff changeset
6402 return;
Ritor1
parents:
diff changeset
6403 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
6404 pParty->uNumArenaPageWins += val;
Ritor1
parents:
diff changeset
6405 return;
Ritor1
parents:
diff changeset
6406 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
6407 pParty->uNumArenaSquireWins += val;
Ritor1
parents:
diff changeset
6408 return;
Ritor1
parents:
diff changeset
6409 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
6410 pParty->uNumArenaKnightWins += val;
Ritor1
parents:
diff changeset
6411 return;
Ritor1
parents:
diff changeset
6412 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
6413 pParty->uNumArenaLordWins += val;
Ritor1
parents:
diff changeset
6414 return;
Ritor1
parents:
diff changeset
6415 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
6416 AddSkillByEvent(&Player::skillStaff, val);
Ritor1
parents:
diff changeset
6417 return;
Ritor1
parents:
diff changeset
6418 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
6419 AddSkillByEvent(&Player::skillSword, val);
Ritor1
parents:
diff changeset
6420 return;
Ritor1
parents:
diff changeset
6421 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
6422 AddSkillByEvent(&Player::skillDagger, val);
Ritor1
parents:
diff changeset
6423 return;
Ritor1
parents:
diff changeset
6424 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
6425 AddSkillByEvent(&Player::skillAxe, val);
Ritor1
parents:
diff changeset
6426 return;
Ritor1
parents:
diff changeset
6427 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
6428 AddSkillByEvent(&Player::skillSpear, val);
Ritor1
parents:
diff changeset
6429 return;
Ritor1
parents:
diff changeset
6430 case VAR_BowSkill:
Ritor1
parents:
diff changeset
6431 AddSkillByEvent(&Player::skillBow, val);
Ritor1
parents:
diff changeset
6432 return;
Ritor1
parents:
diff changeset
6433 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
6434 AddSkillByEvent(&Player::skillMace, val);
Ritor1
parents:
diff changeset
6435 return;
Ritor1
parents:
diff changeset
6436 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
6437 AddSkillByEvent(&Player::skillBlaster, val);
Ritor1
parents:
diff changeset
6438 return;
Ritor1
parents:
diff changeset
6439 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
6440 AddSkillByEvent(&Player::skillShield, val);
Ritor1
parents:
diff changeset
6441 return;
Ritor1
parents:
diff changeset
6442 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
6443 AddSkillByEvent(&Player::skillLeather, val);
Ritor1
parents:
diff changeset
6444 return;
Ritor1
parents:
diff changeset
6445 case VAR_SkillChain:
Ritor1
parents:
diff changeset
6446 AddSkillByEvent(&Player::skillChain, val);
Ritor1
parents:
diff changeset
6447 return;
Ritor1
parents:
diff changeset
6448 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
6449 AddSkillByEvent(&Player::skillPlate, val);
Ritor1
parents:
diff changeset
6450 return;
Ritor1
parents:
diff changeset
6451 case VAR_FireSkill:
Ritor1
parents:
diff changeset
6452 AddSkillByEvent(&Player::skillFire, val);
Ritor1
parents:
diff changeset
6453 return;
Ritor1
parents:
diff changeset
6454 case VAR_AirSkill:
Ritor1
parents:
diff changeset
6455 AddSkillByEvent(&Player::skillAir, val);
Ritor1
parents:
diff changeset
6456 return;
Ritor1
parents:
diff changeset
6457 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
6458 AddSkillByEvent(&Player::skillWater, val);
Ritor1
parents:
diff changeset
6459 return;
Ritor1
parents:
diff changeset
6460 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
6461 AddSkillByEvent(&Player::skillEarth, val);
Ritor1
parents:
diff changeset
6462 return;
Ritor1
parents:
diff changeset
6463 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
6464 AddSkillByEvent(&Player::skillSpirit, val);
Ritor1
parents:
diff changeset
6465 return;
Ritor1
parents:
diff changeset
6466 case VAR_MindSkill:
Ritor1
parents:
diff changeset
6467 AddSkillByEvent(&Player::skillMind, val);
Ritor1
parents:
diff changeset
6468 return;
Ritor1
parents:
diff changeset
6469 case VAR_BodySkill:
Ritor1
parents:
diff changeset
6470 AddSkillByEvent(&Player::skillBody, val);
Ritor1
parents:
diff changeset
6471 return;
Ritor1
parents:
diff changeset
6472 case VAR_LightSkill:
Ritor1
parents:
diff changeset
6473 AddSkillByEvent(&Player::skillLight, val);
Ritor1
parents:
diff changeset
6474 return;
Ritor1
parents:
diff changeset
6475 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
6476 AddSkillByEvent(&Player::skillDark, val);
Ritor1
parents:
diff changeset
6477 return;
Ritor1
parents:
diff changeset
6478 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
6479 AddSkillByEvent(&Player::skillItemId, val);
Ritor1
parents:
diff changeset
6480 return;
Ritor1
parents:
diff changeset
6481 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
6482 AddSkillByEvent(&Player::skillMerchant, val);
Ritor1
parents:
diff changeset
6483 return;
Ritor1
parents:
diff changeset
6484 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
6485 AddSkillByEvent(&Player::skillRepair, val);
Ritor1
parents:
diff changeset
6486 return;
Ritor1
parents:
diff changeset
6487 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
6488 AddSkillByEvent(&Player::skillBodybuilding, val);
Ritor1
parents:
diff changeset
6489 return;
Ritor1
parents:
diff changeset
6490 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
6491 AddSkillByEvent(&Player::skillMeditation, val);
Ritor1
parents:
diff changeset
6492 return;
Ritor1
parents:
diff changeset
6493 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
6494 AddSkillByEvent(&Player::skillPerception, val);
Ritor1
parents:
diff changeset
6495 return;
Ritor1
parents:
diff changeset
6496 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
6497 AddSkillByEvent(&Player::skillDiplomacy, val);
Ritor1
parents:
diff changeset
6498 return;
Ritor1
parents:
diff changeset
6499 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
6500 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
6501 return;
Ritor1
parents:
diff changeset
6502 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
6503 AddSkillByEvent(&Player::skillDisarmTrap, val);
Ritor1
parents:
diff changeset
6504 return;
Ritor1
parents:
diff changeset
6505 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
6506 AddSkillByEvent(&Player::skillDodge, val);
Ritor1
parents:
diff changeset
6507 return;
Ritor1
parents:
diff changeset
6508 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
6509 AddSkillByEvent(&Player::skillUnarmed, val);
Ritor1
parents:
diff changeset
6510 return;
Ritor1
parents:
diff changeset
6511 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
6512 AddSkillByEvent(&Player::skillMonsterId, val);
Ritor1
parents:
diff changeset
6513 return;
Ritor1
parents:
diff changeset
6514 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
6515 AddSkillByEvent(&Player::skillArmsmaster, val);
Ritor1
parents:
diff changeset
6516 return;
Ritor1
parents:
diff changeset
6517 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
6518 AddSkillByEvent(&Player::skillStealing, val);
Ritor1
parents:
diff changeset
6519 return;
Ritor1
parents:
diff changeset
6520 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
6521 AddSkillByEvent(&Player::skillAlchemy, val);
Ritor1
parents:
diff changeset
6522 return;
Ritor1
parents:
diff changeset
6523 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
6524 AddSkillByEvent(&Player::skillLearning, val);
Ritor1
parents:
diff changeset
6525 return;
Ritor1
parents:
diff changeset
6526 default:
Ritor1
parents:
diff changeset
6527 return;
Ritor1
parents:
diff changeset
6528 }
Ritor1
parents:
diff changeset
6529 }
Ritor1
parents:
diff changeset
6530
Ritor1
parents:
diff changeset
6531 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6532 void Player::PlayAwardSound_Anim97()
Ritor1
parents:
diff changeset
6533 {
Ritor1
parents:
diff changeset
6534 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
6535 pEngine->pStru6Instance->SetPlayerBuffAnim(0x97u, playerIndex);
2498
Ritor1
parents:
diff changeset
6536 PlayAwardSound();
Ritor1
parents:
diff changeset
6537 }
Ritor1
parents:
diff changeset
6538
Ritor1
parents:
diff changeset
6539 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6540 void Player::PlayAwardSound_Anim97_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
6541 {
Ritor1
parents:
diff changeset
6542 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
6543 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6544 }
Ritor1
parents:
diff changeset
6545
Ritor1
parents:
diff changeset
6546 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
6547 void Player::AddSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 addSkillValue )
Ritor1
parents:
diff changeset
6548 {
Ritor1
parents:
diff changeset
6549 if ( addSkillValue > 63 )
Ritor1
parents:
diff changeset
6550 {
Ritor1
parents:
diff changeset
6551 this->*skillToSet = (unsigned __int8)addSkillValue | this->*skillToSet & 63;
Ritor1
parents:
diff changeset
6552 }
Ritor1
parents:
diff changeset
6553 else
Ritor1
parents:
diff changeset
6554 {
Ritor1
parents:
diff changeset
6555 this->*skillToSet = min(this->*skillToSet + addSkillValue, 60) | this->*skillToSet & 0xC0;
Ritor1
parents:
diff changeset
6556 }
Ritor1
parents:
diff changeset
6557 PlayAwardSound_Anim97();
Ritor1
parents:
diff changeset
6558 return;
Ritor1
parents:
diff changeset
6559 }
Ritor1
parents:
diff changeset
6560
Ritor1
parents:
diff changeset
6561 //----- (0044B9C4) --------------------------------------------------------
Ritor1
parents:
diff changeset
6562 void Player::SubtractVariable( enum VariableType VarNum, signed int pValue )
Ritor1
parents:
diff changeset
6563 {
Ritor1
parents:
diff changeset
6564 DDM_DLV_Header *locationHeader; // eax@90
Ritor1
parents:
diff changeset
6565 int randGold;
Ritor1
parents:
diff changeset
6566 int randFood;
Ritor1
parents:
diff changeset
6567 int npcIndex;
Ritor1
parents:
diff changeset
6568
Ritor1
parents:
diff changeset
6569 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6570 {
Ritor1
parents:
diff changeset
6571 if ( VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 )
Ritor1
parents:
diff changeset
6572 {
Ritor1
parents:
diff changeset
6573 stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] -= pValue;
Ritor1
parents:
diff changeset
6574 }
Ritor1
parents:
diff changeset
6575 if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 )
Ritor1
parents:
diff changeset
6576 {
Ritor1
parents:
diff changeset
6577 stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] -= pValue;
Ritor1
parents:
diff changeset
6578 }
Ritor1
parents:
diff changeset
6579 return;
Ritor1
parents:
diff changeset
6580 }
Ritor1
parents:
diff changeset
6581
Ritor1
parents:
diff changeset
6582 switch (VarNum)
Ritor1
parents:
diff changeset
6583 {
Ritor1
parents:
diff changeset
6584 case VAR_CurrentHP:
Ritor1
parents:
diff changeset
6585 ReceiveDamage((signed int)pValue, DMGT_PHISYCAL);
Ritor1
parents:
diff changeset
6586 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6587 return;
Ritor1
parents:
diff changeset
6588 case VAR_CurrentSP:
Ritor1
parents:
diff changeset
6589 this->sMana = max(this->sMana - pValue, 0);
Ritor1
parents:
diff changeset
6590 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6591 return;
Ritor1
parents:
diff changeset
6592 case VAR_ACModifier:
Ritor1
parents:
diff changeset
6593 this->sACModifier -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6594 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6595 return;
Ritor1
parents:
diff changeset
6596 case VAR_BaseLevel:
Ritor1
parents:
diff changeset
6597 this->uLevel -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6598 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6599 return;
Ritor1
parents:
diff changeset
6600 case VAR_LevelModifier:
Ritor1
parents:
diff changeset
6601 this->sLevelModifier -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6602 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6603 return;
Ritor1
parents:
diff changeset
6604 case VAR_Age:
Ritor1
parents:
diff changeset
6605 this->sAgeModifier -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6606 return;
Ritor1
parents:
diff changeset
6607 case VAR_Award:
Ritor1
parents:
diff changeset
6608 _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0);
Ritor1
parents:
diff changeset
6609 return;
Ritor1
parents:
diff changeset
6610 case VAR_Experience:
Ritor1
parents:
diff changeset
6611 this->uExperience -= pValue;
Ritor1
parents:
diff changeset
6612 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6613 return;
Ritor1
parents:
diff changeset
6614 case VAR_QBits_QuestsDone:
Ritor1
parents:
diff changeset
6615 _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0);
Ritor1
parents:
diff changeset
6616 this->PlaySound(SPEECH_96, 0);
Ritor1
parents:
diff changeset
6617 return;
Ritor1
parents:
diff changeset
6618 case VAR_PlayerItemInHands:
Ritor1
parents:
diff changeset
6619 for ( uint i = 0; i < 16; ++i )
Ritor1
parents:
diff changeset
6620 {
Ritor1
parents:
diff changeset
6621 int id_ = this->pEquipment.pIndices[i];
Ritor1
parents:
diff changeset
6622 if ( id_ > 0 )
Ritor1
parents:
diff changeset
6623 {
Ritor1
parents:
diff changeset
6624 if ( this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == pValue )
Ritor1
parents:
diff changeset
6625 {
Ritor1
parents:
diff changeset
6626 this->pEquipment.pIndices[i] = 0;
Ritor1
parents:
diff changeset
6627 }
Ritor1
parents:
diff changeset
6628 }
Ritor1
parents:
diff changeset
6629 }
Ritor1
parents:
diff changeset
6630 for (int i = 0; i < 126; i++)
Ritor1
parents:
diff changeset
6631 {
Ritor1
parents:
diff changeset
6632 int id_ = this->pInventoryMatrix[i];
Ritor1
parents:
diff changeset
6633 if ( id_ > 0 )
Ritor1
parents:
diff changeset
6634 {
Ritor1
parents:
diff changeset
6635 if ( this->pInventoryItemList[id_ - 1].uItemID == pValue )
Ritor1
parents:
diff changeset
6636 {
Ritor1
parents:
diff changeset
6637 RemoveItemAtInventoryIndex(i);
Ritor1
parents:
diff changeset
6638 return;
Ritor1
parents:
diff changeset
6639 }
Ritor1
parents:
diff changeset
6640 }
Ritor1
parents:
diff changeset
6641 }
Ritor1
parents:
diff changeset
6642 if ( pParty->pPickedItem.uItemID == pValue )
Ritor1
parents:
diff changeset
6643 {
Ritor1
parents:
diff changeset
6644 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
6645 return;
Ritor1
parents:
diff changeset
6646 }
Ritor1
parents:
diff changeset
6647 return;
Ritor1
parents:
diff changeset
6648 case VAR_FixedGold:
Ritor1
parents:
diff changeset
6649 if ( (unsigned int)pValue > pParty->uNumGold )
Ritor1
parents:
diff changeset
6650 {
Ritor1
parents:
diff changeset
6651 dword_5B65C4_cancelEventProcessing = 1;
Ritor1
parents:
diff changeset
6652 return;
Ritor1
parents:
diff changeset
6653 }
Ritor1
parents:
diff changeset
6654 Party::TakeGold((unsigned int)pValue);
Ritor1
parents:
diff changeset
6655 return;
Ritor1
parents:
diff changeset
6656 case VAR_RandomGold:
Ritor1
parents:
diff changeset
6657 randGold = rand() % (signed int)pValue + 1;
Ritor1
parents:
diff changeset
6658 if ( (unsigned int)randGold > pParty->uNumGold )
Ritor1
parents:
diff changeset
6659 randGold = pParty->uNumGold;
Ritor1
parents:
diff changeset
6660 Party::TakeGold(randGold);
Ritor1
parents:
diff changeset
6661 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], randGold);
Ritor1
parents:
diff changeset
6662 ShowStatusBarString(pTmpBuf.data(), 2);
Ritor1
parents:
diff changeset
6663 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6664 return;
Ritor1
parents:
diff changeset
6665 case VAR_FixedFood:
Ritor1
parents:
diff changeset
6666 Party::TakeFood((unsigned int)pValue);
Ritor1
parents:
diff changeset
6667 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6668 return;
Ritor1
parents:
diff changeset
6669 case VAR_RandomFood:
Ritor1
parents:
diff changeset
6670 randFood = rand() % (signed int)pValue + 1;
Ritor1
parents:
diff changeset
6671 if ( (unsigned int)randFood > pParty->uNumFoodRations )
Ritor1
parents:
diff changeset
6672 randFood = pParty->uNumFoodRations;
Ritor1
parents:
diff changeset
6673 Party::TakeFood(randFood);
Ritor1
parents:
diff changeset
6674 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], randFood);
Ritor1
parents:
diff changeset
6675 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
6676 GameUI_DrawFoodAndGold();
Ritor1
parents:
diff changeset
6677 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6678 return;
Ritor1
parents:
diff changeset
6679 case VAR_MightBonus:
Ritor1
parents:
diff changeset
6680 case VAR_ActualMight:
Ritor1
parents:
diff changeset
6681 this->uMightBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6682 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6683 return;
Ritor1
parents:
diff changeset
6684 case VAR_IntellectBonus:
Ritor1
parents:
diff changeset
6685 case VAR_ActualIntellect:
Ritor1
parents:
diff changeset
6686 this->uIntelligenceBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6687 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6688 return;
Ritor1
parents:
diff changeset
6689 case VAR_PersonalityBonus:
Ritor1
parents:
diff changeset
6690 case VAR_ActualPersonality:
Ritor1
parents:
diff changeset
6691 this->uWillpowerBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6692 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6693 return;
Ritor1
parents:
diff changeset
6694 case VAR_EnduranceBonus:
Ritor1
parents:
diff changeset
6695 case VAR_ActualEndurance:
Ritor1
parents:
diff changeset
6696 this->uEnduranceBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6697 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6698 return;
Ritor1
parents:
diff changeset
6699 case VAR_SpeedBonus:
Ritor1
parents:
diff changeset
6700 case VAR_ActualSpeed:
Ritor1
parents:
diff changeset
6701 this->uSpeedBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6702 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6703 return;
Ritor1
parents:
diff changeset
6704 case VAR_AccuracyBonus:
Ritor1
parents:
diff changeset
6705 case VAR_ActualAccuracy:
Ritor1
parents:
diff changeset
6706 this->uAccuracyBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6707 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6708 return;
Ritor1
parents:
diff changeset
6709 case VAR_LuckBonus:
Ritor1
parents:
diff changeset
6710 case VAR_ActualLuck:
Ritor1
parents:
diff changeset
6711 this->uLuckBonus -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6712 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6713 return;
Ritor1
parents:
diff changeset
6714 case VAR_BaseMight:
Ritor1
parents:
diff changeset
6715 this->uMight -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6716 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6717 return;
Ritor1
parents:
diff changeset
6718 case VAR_BaseIntellect:
Ritor1
parents:
diff changeset
6719 this->uIntelligence -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6720 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6721 return;
Ritor1
parents:
diff changeset
6722 case VAR_BasePersonality:
Ritor1
parents:
diff changeset
6723 this->uWillpower -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6724 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6725 return;
Ritor1
parents:
diff changeset
6726 case VAR_BaseEndurance:
Ritor1
parents:
diff changeset
6727 this->uEndurance -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6728 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6729 return;
Ritor1
parents:
diff changeset
6730 case VAR_BaseSpeed:
Ritor1
parents:
diff changeset
6731 this->uSpeed -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6732 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6733 return;
Ritor1
parents:
diff changeset
6734 case VAR_BaseAccuracy:
Ritor1
parents:
diff changeset
6735 this->uAccuracy -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6736 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6737 return;
Ritor1
parents:
diff changeset
6738 case VAR_BaseLuck:
Ritor1
parents:
diff changeset
6739 this->uLuck -= (unsigned __int16)pValue;
Ritor1
parents:
diff changeset
6740 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6741 return;
Ritor1
parents:
diff changeset
6742 case VAR_FireResistance:
Ritor1
parents:
diff changeset
6743 this->sResFireBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6744 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6745 return;
Ritor1
parents:
diff changeset
6746 case VAR_AirResistance:
Ritor1
parents:
diff changeset
6747 this->sResAirBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6748 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6749 return;
Ritor1
parents:
diff changeset
6750 case VAR_WaterResistance:
Ritor1
parents:
diff changeset
6751 this->sResWaterBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6752 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6753 return;
Ritor1
parents:
diff changeset
6754 case VAR_EarthResistance:
Ritor1
parents:
diff changeset
6755 this->sResEarthBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6756 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6757 return;
Ritor1
parents:
diff changeset
6758 case VAR_SpiritResistance:
Ritor1
parents:
diff changeset
6759 this->sResSpiritBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6760 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6761 return;
Ritor1
parents:
diff changeset
6762 case VAR_MindResistance:
Ritor1
parents:
diff changeset
6763 this->sResMindBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6764 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6765 return;
Ritor1
parents:
diff changeset
6766 case VAR_BodyResistance:
Ritor1
parents:
diff changeset
6767 this->sResBodyBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6768 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6769 return;
Ritor1
parents:
diff changeset
6770 case VAR_LightResistance:
Ritor1
parents:
diff changeset
6771 this->sResLightBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6772 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6773 return;
Ritor1
parents:
diff changeset
6774 case VAR_DarkResistance:
Ritor1
parents:
diff changeset
6775 this->sResDarkBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6776 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6777 return;
Ritor1
parents:
diff changeset
6778 case VAR_MagicResistance:
Ritor1
parents:
diff changeset
6779 this->sResMagicBase -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6780 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6781 return;
Ritor1
parents:
diff changeset
6782 case VAR_FireResistanceBonus:
Ritor1
parents:
diff changeset
6783 this->sResFireBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6784 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6785 return;
Ritor1
parents:
diff changeset
6786 case VAR_AirResistanceBonus:
Ritor1
parents:
diff changeset
6787 this->sResAirBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6788 this->PlayAwardSound_Anim98_Face(SPEECH_92);
Ritor1
parents:
diff changeset
6789 return;
Ritor1
parents:
diff changeset
6790 case VAR_WaterResistanceBonus:
Ritor1
parents:
diff changeset
6791 this->sResWaterBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6792 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6793 return;
Ritor1
parents:
diff changeset
6794 case VAR_EarthResistanceBonus:
Ritor1
parents:
diff changeset
6795 this->sResEarthBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6796 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6797 return;
Ritor1
parents:
diff changeset
6798 case VAR_SpiritResistanceBonus:
Ritor1
parents:
diff changeset
6799 this->sResSpiritBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6800 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6801 return;
Ritor1
parents:
diff changeset
6802 case VAR_MindResistanceBonus:
Ritor1
parents:
diff changeset
6803 this->sResMindBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6804 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6805 return;
Ritor1
parents:
diff changeset
6806 case VAR_BodyResistanceBonus:
Ritor1
parents:
diff changeset
6807 this->sResBodyBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6808 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6809 return;
Ritor1
parents:
diff changeset
6810 case VAR_LightResistanceBonus:
Ritor1
parents:
diff changeset
6811 this->sResLightBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6812 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6813 return;
Ritor1
parents:
diff changeset
6814 case VAR_DarkResistanceBonus:
Ritor1
parents:
diff changeset
6815 this->sResDarkBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6816 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6817 return;
Ritor1
parents:
diff changeset
6818 case VAR_MagicResistanceBonus:
Ritor1
parents:
diff changeset
6819 this->sResMagicBonus -= (signed __int16)pValue;
Ritor1
parents:
diff changeset
6820 this->PlayAwardSound_Anim98_Face(SPEECH_91);
Ritor1
parents:
diff changeset
6821 return;
Ritor1
parents:
diff changeset
6822 case VAR_StaffSkill:
Ritor1
parents:
diff changeset
6823 this->skillStaff -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6824 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6825 return;
Ritor1
parents:
diff changeset
6826 case VAR_SwordSkill:
Ritor1
parents:
diff changeset
6827 this->skillSword -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6828 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6829 return;
Ritor1
parents:
diff changeset
6830 case VAR_DaggerSkill:
Ritor1
parents:
diff changeset
6831 this->skillDagger -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6832 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6833 return;
Ritor1
parents:
diff changeset
6834 case VAR_AxeSkill:
Ritor1
parents:
diff changeset
6835 this->skillAxe -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6836 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6837 return;
Ritor1
parents:
diff changeset
6838 case VAR_SpearSkill:
Ritor1
parents:
diff changeset
6839 this->skillSpear -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6840 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6841 return;
Ritor1
parents:
diff changeset
6842 case VAR_BowSkill:
Ritor1
parents:
diff changeset
6843 this->skillBow -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6844 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6845 return;
Ritor1
parents:
diff changeset
6846 case VAR_MaceSkill:
Ritor1
parents:
diff changeset
6847 this->skillMace -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6848 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6849 return;
Ritor1
parents:
diff changeset
6850 case VAR_BlasterSkill:
Ritor1
parents:
diff changeset
6851 this->skillBlaster -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6852 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6853 return;
Ritor1
parents:
diff changeset
6854 case VAR_ShieldSkill:
Ritor1
parents:
diff changeset
6855 this->skillShield -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6856 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6857 return;
Ritor1
parents:
diff changeset
6858 case VAR_LeatherSkill:
Ritor1
parents:
diff changeset
6859 this->skillLearning -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6860 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6861 return;
Ritor1
parents:
diff changeset
6862 case VAR_SkillChain:
Ritor1
parents:
diff changeset
6863 this->skillChain -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6864 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6865 return;
Ritor1
parents:
diff changeset
6866 case VAR_PlateSkill:
Ritor1
parents:
diff changeset
6867 this->skillPlate -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6868 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6869 return;
Ritor1
parents:
diff changeset
6870 case VAR_FireSkill:
Ritor1
parents:
diff changeset
6871 this->skillFire -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6872 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6873 return;
Ritor1
parents:
diff changeset
6874 case VAR_AirSkill:
Ritor1
parents:
diff changeset
6875 this->skillAir -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6876 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6877 return;
Ritor1
parents:
diff changeset
6878 case VAR_WaterSkill:
Ritor1
parents:
diff changeset
6879 this->skillWater -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6880 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6881 return;
Ritor1
parents:
diff changeset
6882 case VAR_EarthSkill:
Ritor1
parents:
diff changeset
6883 this->skillEarth -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6884 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6885 return;
Ritor1
parents:
diff changeset
6886 case VAR_SpiritSkill:
Ritor1
parents:
diff changeset
6887 this->skillSpirit -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6888 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6889 return;
Ritor1
parents:
diff changeset
6890 case VAR_MindSkill:
Ritor1
parents:
diff changeset
6891 this->skillMind -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6892 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6893 return;
Ritor1
parents:
diff changeset
6894 case VAR_BodySkill:
Ritor1
parents:
diff changeset
6895 this->skillBody -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6896 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6897 return;
Ritor1
parents:
diff changeset
6898 case VAR_LightSkill:
Ritor1
parents:
diff changeset
6899 this->skillLight -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6900 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6901 return;
Ritor1
parents:
diff changeset
6902 case VAR_DarkSkill:
Ritor1
parents:
diff changeset
6903 this->skillDark -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6904 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6905 return;
Ritor1
parents:
diff changeset
6906 case VAR_IdentifyItemSkill:
Ritor1
parents:
diff changeset
6907 this->skillItemId -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6908 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6909 return;
Ritor1
parents:
diff changeset
6910 case VAR_MerchantSkill:
Ritor1
parents:
diff changeset
6911 this->skillMerchant -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6912 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6913 return;
Ritor1
parents:
diff changeset
6914 case VAR_RepairSkill:
Ritor1
parents:
diff changeset
6915 this->skillRepair -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6916 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6917 return;
Ritor1
parents:
diff changeset
6918 case VAR_BodybuildingSkill:
Ritor1
parents:
diff changeset
6919 this->skillBodybuilding -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6920 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6921 return;
Ritor1
parents:
diff changeset
6922 case VAR_MeditationSkill:
Ritor1
parents:
diff changeset
6923 this->skillMeditation -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6924 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6925 return;
Ritor1
parents:
diff changeset
6926 case VAR_PerceptionSkill:
Ritor1
parents:
diff changeset
6927 this->skillPerception -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6928 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6929 return;
Ritor1
parents:
diff changeset
6930 case VAR_DiplomacySkill:
Ritor1
parents:
diff changeset
6931 this->skillDiplomacy -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6932 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6933 return;
Ritor1
parents:
diff changeset
6934 case VAR_ThieverySkill:
Ritor1
parents:
diff changeset
6935 Error ("Thieving unsupported");
Ritor1
parents:
diff changeset
6936 return;
Ritor1
parents:
diff changeset
6937 case VAR_DisarmTrapSkill:
Ritor1
parents:
diff changeset
6938 this->skillDisarmTrap -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6939 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6940 return;
Ritor1
parents:
diff changeset
6941 case VAR_DodgeSkill:
Ritor1
parents:
diff changeset
6942 this->skillDodge -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6943 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6944 return;
Ritor1
parents:
diff changeset
6945 case VAR_UnarmedSkill:
Ritor1
parents:
diff changeset
6946 this->skillUnarmed -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6947 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6948 return;
Ritor1
parents:
diff changeset
6949 case VAR_IdentifyMonsterSkill:
Ritor1
parents:
diff changeset
6950 this->skillMonsterId -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6951 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6952 return;
Ritor1
parents:
diff changeset
6953 case VAR_ArmsmasterSkill:
Ritor1
parents:
diff changeset
6954 this->skillArmsmaster -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6955 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6956 return;
Ritor1
parents:
diff changeset
6957 case VAR_StealingSkill:
Ritor1
parents:
diff changeset
6958 this->skillStealing -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6959 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6960 return;
Ritor1
parents:
diff changeset
6961 case VAR_AlchemySkill:
Ritor1
parents:
diff changeset
6962 this->skillAlchemy -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6963 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6964 return;
Ritor1
parents:
diff changeset
6965 case VAR_LearningSkill:
Ritor1
parents:
diff changeset
6966 this->skillLearning -= (unsigned __int8)pValue;
Ritor1
parents:
diff changeset
6967 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6968 return;
Ritor1
parents:
diff changeset
6969 case VAR_Cursed:
Ritor1
parents:
diff changeset
6970 this->pConditions[Condition_Cursed] = 0;
Ritor1
parents:
diff changeset
6971 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6972 return;
Ritor1
parents:
diff changeset
6973 case VAR_Weak:
Ritor1
parents:
diff changeset
6974 this->pConditions[Condition_Weak] = 0;
Ritor1
parents:
diff changeset
6975 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6976 return;
Ritor1
parents:
diff changeset
6977 case VAR_Asleep:
Ritor1
parents:
diff changeset
6978 this->pConditions[Condition_Sleep] = 0;
Ritor1
parents:
diff changeset
6979 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6980 return;
Ritor1
parents:
diff changeset
6981 case VAR_Afraid:
Ritor1
parents:
diff changeset
6982 this->pConditions[Condition_Fear] = 0;
Ritor1
parents:
diff changeset
6983 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6984 return;
Ritor1
parents:
diff changeset
6985 case VAR_Drunk:
Ritor1
parents:
diff changeset
6986 this->pConditions[Condition_Drunk] = 0;
Ritor1
parents:
diff changeset
6987 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6988 return;
Ritor1
parents:
diff changeset
6989 case VAR_Insane:
Ritor1
parents:
diff changeset
6990 this->pConditions[Condition_Insane] = 0;
Ritor1
parents:
diff changeset
6991 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6992 return;
Ritor1
parents:
diff changeset
6993 case VAR_PoisonedGreen:
Ritor1
parents:
diff changeset
6994 this->pConditions[Condition_Poison_Weak] = 0;
Ritor1
parents:
diff changeset
6995 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
6996 return;
Ritor1
parents:
diff changeset
6997 case VAR_DiseasedGreen:
Ritor1
parents:
diff changeset
6998 this->pConditions[Condition_Disease_Weak] = 0;
Ritor1
parents:
diff changeset
6999 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7000 return;
Ritor1
parents:
diff changeset
7001 case VAR_PoisonedYellow:
Ritor1
parents:
diff changeset
7002 this->pConditions[Condition_Poison_Medium] = 0;
Ritor1
parents:
diff changeset
7003 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7004 return;
Ritor1
parents:
diff changeset
7005 case VAR_DiseasedYellow:
Ritor1
parents:
diff changeset
7006 this->pConditions[Condition_Disease_Medium] = 0;
Ritor1
parents:
diff changeset
7007 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7008 return;
Ritor1
parents:
diff changeset
7009 case VAR_PoisonedRed:
Ritor1
parents:
diff changeset
7010 this->pConditions[Condition_Poison_Severe] = 0;
Ritor1
parents:
diff changeset
7011 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7012 return;
Ritor1
parents:
diff changeset
7013 case VAR_DiseasedRed:
Ritor1
parents:
diff changeset
7014 this->pConditions[Condition_Disease_Severe] = 0;
Ritor1
parents:
diff changeset
7015 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7016 return;
Ritor1
parents:
diff changeset
7017 case VAR_Paralyzed:
Ritor1
parents:
diff changeset
7018 this->pConditions[Condition_Paralyzed] = 0;
Ritor1
parents:
diff changeset
7019 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7020 return;
Ritor1
parents:
diff changeset
7021 case VAR_Unconsious:
Ritor1
parents:
diff changeset
7022 this->pConditions[Condition_Unconcious] = 0;
Ritor1
parents:
diff changeset
7023 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7024 return;
Ritor1
parents:
diff changeset
7025 case VAR_Dead:
Ritor1
parents:
diff changeset
7026 this->pConditions[Condition_Dead] = 0;
Ritor1
parents:
diff changeset
7027 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7028 return;
Ritor1
parents:
diff changeset
7029 case VAR_Stoned:
Ritor1
parents:
diff changeset
7030 this->pConditions[Condition_Pertified] = 0;
Ritor1
parents:
diff changeset
7031 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7032 return;
Ritor1
parents:
diff changeset
7033 case VAR_Eradicated:
Ritor1
parents:
diff changeset
7034 this->pConditions[Condition_Eradicated] = 0;
Ritor1
parents:
diff changeset
7035 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7036 return;
Ritor1
parents:
diff changeset
7037 case VAR_AutoNotes:
Ritor1
parents:
diff changeset
7038 _449B7E_toggle_bit(pParty->_autonote_bits, pValue - 1, 0);
Ritor1
parents:
diff changeset
7039 return;
Ritor1
parents:
diff changeset
7040 case VAR_NPCs2:
Ritor1
parents:
diff changeset
7041 npcIndex = 0;
Ritor1
parents:
diff changeset
7042 GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &npcIndex);
Ritor1
parents:
diff changeset
7043 if ( npcIndex == pValue )
Ritor1
parents:
diff changeset
7044 {
Ritor1
parents:
diff changeset
7045 npcIdToDismissAfterDialogue = pValue;
Ritor1
parents:
diff changeset
7046 }
Ritor1
parents:
diff changeset
7047 else
Ritor1
parents:
diff changeset
7048 {
Ritor1
parents:
diff changeset
7049 npcIdToDismissAfterDialogue = 0;
Ritor1
parents:
diff changeset
7050 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
7051 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
Ritor1
parents:
diff changeset
7052 pParty->CountHirelings();
Ritor1
parents:
diff changeset
7053 viewparams->bRedrawGameUI = true;
Ritor1
parents:
diff changeset
7054 }
Ritor1
parents:
diff changeset
7055 return;
Ritor1
parents:
diff changeset
7056 case VAR_HiredNPCHasSpeciality:
Ritor1
parents:
diff changeset
7057 for (unsigned int i = 0; i < pNPCStats->uNumNewNPCs; i++)
Ritor1
parents:
diff changeset
7058 {
Ritor1
parents:
diff changeset
7059 if (pNPCStats->pNewNPCData[i].uProfession == pValue)
Ritor1
parents:
diff changeset
7060 {
Ritor1
parents:
diff changeset
7061 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
Ritor1
parents:
diff changeset
7062 }
Ritor1
parents:
diff changeset
7063 }
Ritor1
parents:
diff changeset
7064 if ( pParty->pHirelings[0].uProfession == pValue )
Ritor1
parents:
diff changeset
7065 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
Ritor1
parents:
diff changeset
7066 if ( pParty->pHirelings[1].uProfession == pValue )
Ritor1
parents:
diff changeset
7067 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
Ritor1
parents:
diff changeset
7068 pParty->hirelingScrollPosition = 0;
Ritor1
parents:
diff changeset
7069 pParty->CountHirelings();
Ritor1
parents:
diff changeset
7070 return;
Ritor1
parents:
diff changeset
7071 case VAR_NumSkillPoints:
Ritor1
parents:
diff changeset
7072 if ((unsigned int)pValue <= this->uSkillPoints)
Ritor1
parents:
diff changeset
7073 {
Ritor1
parents:
diff changeset
7074 this->uSkillPoints -= pValue;
Ritor1
parents:
diff changeset
7075 }
Ritor1
parents:
diff changeset
7076 else
Ritor1
parents:
diff changeset
7077 {
Ritor1
parents:
diff changeset
7078 this->uSkillPoints = 0;
Ritor1
parents:
diff changeset
7079 }
Ritor1
parents:
diff changeset
7080 return;
Ritor1
parents:
diff changeset
7081 case VAR_ReputationInCurrentLocation:
Ritor1
parents:
diff changeset
7082 locationHeader = &pOutdoor->ddm;
Ritor1
parents:
diff changeset
7083 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
Ritor1
parents:
diff changeset
7084 locationHeader = &pIndoor->dlv;
Ritor1
parents:
diff changeset
7085 locationHeader->uReputation -= pValue;
Ritor1
parents:
diff changeset
7086 if (locationHeader->uReputation < -10000)
Ritor1
parents:
diff changeset
7087 locationHeader->uReputation = -10000;
Ritor1
parents:
diff changeset
7088 return;
Ritor1
parents:
diff changeset
7089 case VAR_GoldInBank:
Ritor1
parents:
diff changeset
7090 if ( (unsigned int)pValue <= pParty->uNumGoldInBank )
Ritor1
parents:
diff changeset
7091 {
Ritor1
parents:
diff changeset
7092 pParty->uNumGoldInBank -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7093 }
Ritor1
parents:
diff changeset
7094 else
Ritor1
parents:
diff changeset
7095 {
Ritor1
parents:
diff changeset
7096 dword_5B65C4_cancelEventProcessing = 1;
Ritor1
parents:
diff changeset
7097 }
Ritor1
parents:
diff changeset
7098 return;
Ritor1
parents:
diff changeset
7099 case VAR_NumDeaths:
Ritor1
parents:
diff changeset
7100 pParty->uNumDeaths -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7101 return;
Ritor1
parents:
diff changeset
7102 case VAR_NumBounties:
Ritor1
parents:
diff changeset
7103 pParty->uNumBountiesCollected -= (unsigned int)pValue;
Ritor1
parents:
diff changeset
7104 return;
Ritor1
parents:
diff changeset
7105 case VAR_PrisonTerms:
Ritor1
parents:
diff changeset
7106 pParty->uNumPrisonTerms -= (int)pValue;
Ritor1
parents:
diff changeset
7107 return;
Ritor1
parents:
diff changeset
7108 case VAR_ArenaWinsPage:
Ritor1
parents:
diff changeset
7109 pParty->uNumArenaPageWins -= (char)pValue;
Ritor1
parents:
diff changeset
7110 return;
Ritor1
parents:
diff changeset
7111 case VAR_ArenaWinsSquire:
Ritor1
parents:
diff changeset
7112 pParty->uNumArenaSquireWins -= (char)pValue;
Ritor1
parents:
diff changeset
7113 return;
Ritor1
parents:
diff changeset
7114 case VAR_ArenaWinsKnight:
Ritor1
parents:
diff changeset
7115 pParty->uNumArenaKnightWins -= (char)pValue;
Ritor1
parents:
diff changeset
7116 return;
Ritor1
parents:
diff changeset
7117 case VAR_ArenaWinsLord:
Ritor1
parents:
diff changeset
7118 pParty->uNumArenaLordWins -= (char)pValue;
Ritor1
parents:
diff changeset
7119 return;
Ritor1
parents:
diff changeset
7120 }
Ritor1
parents:
diff changeset
7121 }
Ritor1
parents:
diff changeset
7122 // 5B65C4: using guessed type int dword_5B65C4;
Ritor1
parents:
diff changeset
7123 // 5B65CC: using guessed type int dword_5B65CC;
Ritor1
parents:
diff changeset
7124
Ritor1
parents:
diff changeset
7125 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
7126 void Player::PlayAwardSound_Anim98()
Ritor1
parents:
diff changeset
7127 {
Ritor1
parents:
diff changeset
7128 int playerIndex = GetPlayerIndex();
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7129 pEngine->pStru6Instance->SetPlayerBuffAnim(0x98u, playerIndex);
2498
Ritor1
parents:
diff changeset
7130 PlayAwardSound();
Ritor1
parents:
diff changeset
7131 }
Ritor1
parents:
diff changeset
7132
Ritor1
parents:
diff changeset
7133 //----- (new function) --------------------------------------------------------
Ritor1
parents:
diff changeset
7134 void Player::PlayAwardSound_Anim98_Face( PlayerSpeech speech )
Ritor1
parents:
diff changeset
7135 {
Ritor1
parents:
diff changeset
7136 this->PlaySound(speech, 0);
Ritor1
parents:
diff changeset
7137 PlayAwardSound_Anim98();
Ritor1
parents:
diff changeset
7138 }
Ritor1
parents:
diff changeset
7139
Ritor1
parents:
diff changeset
7140 //----- (00467E7F) --------------------------------------------------------
Ritor1
parents:
diff changeset
7141 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType)
Ritor1
parents:
diff changeset
7142 {
Ritor1
parents:
diff changeset
7143 int itemAnchor; // ebx@1
Ritor1
parents:
diff changeset
7144 int itemInvLocation; // edx@1
Ritor1
parents:
diff changeset
7145 int freeSlot; // eax@3
Ritor1
parents:
diff changeset
7146 ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1
Ritor1
parents:
diff changeset
7147
Ritor1
parents:
diff changeset
7148 tempPickedItem.Reset();
Ritor1
parents:
diff changeset
7149 itemAnchor = pEquipTypeToBodyAnchor[uEquipType];
Ritor1
parents:
diff changeset
7150 itemInvLocation = pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor];
Ritor1
parents:
diff changeset
7151 if ( itemInvLocation )//ïåðåîäåòüñÿ â äðóãóþ âåùü
Ritor1
parents:
diff changeset
7152 {
Ritor1
parents:
diff changeset
7153 memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem));
Ritor1
parents:
diff changeset
7154 pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1].uBodyAnchor = 0;
Ritor1
parents:
diff changeset
7155 pParty->pPickedItem.Reset();
Ritor1
parents:
diff changeset
7156 pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1]);
Ritor1
parents:
diff changeset
7157 tempPickedItem.uBodyAnchor = itemAnchor + 1;
Ritor1
parents:
diff changeset
7158 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[itemInvLocation - 1], &tempPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7159 pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] = itemInvLocation;
Ritor1
parents:
diff changeset
7160 }
Ritor1
parents:
diff changeset
7161 else//îäåòü âåùü
Ritor1
parents:
diff changeset
7162 {
Ritor1
parents:
diff changeset
7163 freeSlot = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot();
Ritor1
parents:
diff changeset
7164 if (freeSlot >= 0)
Ritor1
parents:
diff changeset
7165 {
Ritor1
parents:
diff changeset
7166 pParty->pPickedItem.uBodyAnchor = itemAnchor + 1;
Ritor1
parents:
diff changeset
7167 memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[freeSlot], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7168 pPlayers[uActiveCharacter]->pEquipment.pIndices[itemAnchor] = freeSlot + 1;
Ritor1
parents:
diff changeset
7169 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7170 }
Ritor1
parents:
diff changeset
7171 }
Ritor1
parents:
diff changeset
7172 }
Ritor1
parents:
diff changeset
7173
Ritor1
parents:
diff changeset
7174 //----- (0049387A) --------------------------------------------------------
Ritor1
parents:
diff changeset
7175 int CycleCharacter(bool backwards)
Ritor1
parents:
diff changeset
7176 {
Ritor1
parents:
diff changeset
7177 const int PARTYSIZE = 4;
Ritor1
parents:
diff changeset
7178 int valToAdd = backwards ? (PARTYSIZE - 2) : 0;
Ritor1
parents:
diff changeset
7179 int mult = backwards ? -1 : 1;
Ritor1
parents:
diff changeset
7180
Ritor1
parents:
diff changeset
7181 for (int i = 0; i < (PARTYSIZE - 1); i++)
Ritor1
parents:
diff changeset
7182 {
Ritor1
parents:
diff changeset
7183 int currCharId = ((uActiveCharacter + mult * i + valToAdd) % PARTYSIZE) + 1;
Ritor1
parents:
diff changeset
7184 if ( pPlayers[currCharId]->uTimeToRecovery == 0 )
Ritor1
parents:
diff changeset
7185 {
Ritor1
parents:
diff changeset
7186 return currCharId;
Ritor1
parents:
diff changeset
7187 }
Ritor1
parents:
diff changeset
7188 }
Ritor1
parents:
diff changeset
7189 return uActiveCharacter;
Ritor1
parents:
diff changeset
7190 }
Ritor1
parents:
diff changeset
7191
Ritor1
parents:
diff changeset
7192 //----- (0043EE77) --------------------------------------------------------
Ritor1
parents:
diff changeset
7193 bool Player::HasUnderwaterSuitEquipped() //the original function took the player number as a parameter. if it was 0, the whole party was checked. calls with the parameter 0 have been changed to calls to this for every player
Ritor1
parents:
diff changeset
7194 {
Ritor1
parents:
diff changeset
7195 if (GetArmorItem() == nullptr || GetArmorItem()->uItemID != 604)
Ritor1
parents:
diff changeset
7196 {
Ritor1
parents:
diff changeset
7197 return false;
Ritor1
parents:
diff changeset
7198 }
Ritor1
parents:
diff changeset
7199 return true;
Ritor1
parents:
diff changeset
7200 }
Ritor1
parents:
diff changeset
7201
Ritor1
parents:
diff changeset
7202 //----- (0043EE15) --------------------------------------------------------
Ritor1
parents:
diff changeset
7203 bool Player::HasItem( unsigned int uItemID, bool checkHeldItem )
Ritor1
parents:
diff changeset
7204 {
Ritor1
parents:
diff changeset
7205 if ( !checkHeldItem || pParty->pPickedItem.uItemID != uItemID )
Ritor1
parents:
diff changeset
7206 {
Ritor1
parents:
diff changeset
7207 for ( uint i = 0; i < 126; ++i )
Ritor1
parents:
diff changeset
7208 {
Ritor1
parents:
diff changeset
7209 if ( this->pInventoryMatrix[i] > 0 )
Ritor1
parents:
diff changeset
7210 {
Ritor1
parents:
diff changeset
7211 if ( (unsigned int)this->pInventoryItemList[this->pInventoryMatrix[i] - 1].uItemID == uItemID )
Ritor1
parents:
diff changeset
7212 return true;
Ritor1
parents:
diff changeset
7213 }
Ritor1
parents:
diff changeset
7214 }
Ritor1
parents:
diff changeset
7215 for ( uint i = 0; i < 16; ++i )
Ritor1
parents:
diff changeset
7216 {
Ritor1
parents:
diff changeset
7217 if ( this->pEquipment.pIndices[i] )
Ritor1
parents:
diff changeset
7218 {
Ritor1
parents:
diff changeset
7219 if ( (unsigned int)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == uItemID )
Ritor1
parents:
diff changeset
7220 return true;
Ritor1
parents:
diff changeset
7221 }
Ritor1
parents:
diff changeset
7222 }
Ritor1
parents:
diff changeset
7223 return false;
Ritor1
parents:
diff changeset
7224 }
Ritor1
parents:
diff changeset
7225 else
Ritor1
parents:
diff changeset
7226 {
Ritor1
parents:
diff changeset
7227 return true;
Ritor1
parents:
diff changeset
7228 }
Ritor1
parents:
diff changeset
7229 }
Ritor1
parents:
diff changeset
7230 //----- (0043EDB9) --------------------------------------------------------
Ritor1
parents:
diff changeset
7231 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this)
Ritor1
parents:
diff changeset
7232 {
Ritor1
parents:
diff changeset
7233 CHARACTER_RACE race; // edi@2
Ritor1
parents:
diff changeset
7234 PLAYER_SEX sex; // eax@2
Ritor1
parents:
diff changeset
7235
Ritor1
parents:
diff changeset
7236 for (int i = 1; i <= 4; i++)
Ritor1
parents:
diff changeset
7237 {
Ritor1
parents:
diff changeset
7238 race = pPlayers[i]->GetRace();
Ritor1
parents:
diff changeset
7239 sex = pPlayers[i]->GetSexByVoice();
Ritor1
parents:
diff changeset
7240 switch(_this)
Ritor1
parents:
diff changeset
7241 {
Ritor1
parents:
diff changeset
7242 case 0:
Ritor1
parents:
diff changeset
7243 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_MALE )
Ritor1
parents:
diff changeset
7244 return true;
Ritor1
parents:
diff changeset
7245 break;
Ritor1
parents:
diff changeset
7246 case 1:
Ritor1
parents:
diff changeset
7247 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_FEMALE )
Ritor1
parents:
diff changeset
7248 return true;
Ritor1
parents:
diff changeset
7249 break;
Ritor1
parents:
diff changeset
7250 case 2:
Ritor1
parents:
diff changeset
7251 if ( race == CHARACTER_RACE_DWARF && sex == SEX_MALE )
Ritor1
parents:
diff changeset
7252 return true;
Ritor1
parents:
diff changeset
7253 break;
Ritor1
parents:
diff changeset
7254 case 3:
Ritor1
parents:
diff changeset
7255 if ( race == CHARACTER_RACE_DWARF && sex == SEX_FEMALE )
Ritor1
parents:
diff changeset
7256 return true;
Ritor1
parents:
diff changeset
7257 break;
Ritor1
parents:
diff changeset
7258 }
Ritor1
parents:
diff changeset
7259 }
Ritor1
parents:
diff changeset
7260 return false;
Ritor1
parents:
diff changeset
7261 }
Ritor1
parents:
diff changeset
7262
Ritor1
parents:
diff changeset
7263 //----- (0043ED6F) --------------------------------------------------------
Ritor1
parents:
diff changeset
7264 bool IsDwarfPresentInParty(bool a1)
Ritor1
parents:
diff changeset
7265 {
Ritor1
parents:
diff changeset
7266 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
7267 {
Ritor1
parents:
diff changeset
7268 CHARACTER_RACE race = pParty->pPlayers[i].GetRace();
Ritor1
parents:
diff changeset
7269
Ritor1
parents:
diff changeset
7270 if (race == CHARACTER_RACE_DWARF && a1)
Ritor1
parents:
diff changeset
7271 return true;
Ritor1
parents:
diff changeset
7272 else if (race != CHARACTER_RACE_DWARF && !a1)
Ritor1
parents:
diff changeset
7273 return true;
Ritor1
parents:
diff changeset
7274 }
Ritor1
parents:
diff changeset
7275 return false;
Ritor1
parents:
diff changeset
7276 }
Ritor1
parents:
diff changeset
7277
Ritor1
parents:
diff changeset
7278 //----- (00439FCB) --------------------------------------------------------
Ritor1
parents:
diff changeset
7279 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int dmgSource, Vec3_int_ *pPos, signed int a4)
Ritor1
parents:
diff changeset
7280 {
Ritor1
parents:
diff changeset
7281 Player *playerPtr; // ebx@3
Ritor1
parents:
diff changeset
7282 Actor *actorPtr; // esi@3
Ritor1
parents:
diff changeset
7283 int spellId; // eax@38
Ritor1
parents:
diff changeset
7284 signed int recvdMagicDmg; // eax@139
Ritor1
parents:
diff changeset
7285 int v72[4]; // [sp+30h] [bp-24h]@164
Ritor1
parents:
diff changeset
7286 int healthBeforeRecvdDamage; // [sp+48h] [bp-Ch]@3
Ritor1
parents:
diff changeset
7287 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
7288
Ritor1
parents:
diff changeset
7289 uActorID = PID_ID(uObjID);
Ritor1
parents:
diff changeset
7290 if ( PID_TYPE(uObjID) != 2)
Ritor1
parents:
diff changeset
7291 {
Ritor1
parents:
diff changeset
7292 playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7293 actorPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
7294 healthBeforeRecvdDamage = playerPtr->sHealth;
Ritor1
parents:
diff changeset
7295 if ( PID_TYPE(uObjID) != 3 || !actorPtr->ActorHitOrMiss(playerPtr) )
Ritor1
parents:
diff changeset
7296 return;
Ritor1
parents:
diff changeset
7297 ItemGen* equippedArmor = playerPtr->GetArmorItem();
Ritor1
parents:
diff changeset
7298 SoundID soundToPlay;
Ritor1
parents:
diff changeset
7299 if ( !equippedArmor
Ritor1
parents:
diff changeset
7300 || equippedArmor->IsBroken()
Ritor1
parents:
diff changeset
7301 ||
Ritor1
parents:
diff changeset
7302 (equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_CHAIN
Ritor1
parents:
diff changeset
7303 && equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_PLATE
Ritor1
parents:
diff changeset
7304 )
Ritor1
parents:
diff changeset
7305 )
Ritor1
parents:
diff changeset
7306 {
Ritor1
parents:
diff changeset
7307 int randVal = rand() % 4;
Ritor1
parents:
diff changeset
7308 switch (randVal)
Ritor1
parents:
diff changeset
7309 {
Ritor1
parents:
diff changeset
7310 case 0 : soundToPlay = (SoundID)108; break;
Ritor1
parents:
diff changeset
7311 case 1 : soundToPlay = (SoundID)109; break;
Ritor1
parents:
diff changeset
7312 case 2 : soundToPlay = (SoundID)110; break;
Ritor1
parents:
diff changeset
7313 case 3 : soundToPlay = (SoundID)44; break;
Ritor1
parents:
diff changeset
7314 default: Error("Unexpected sound value");
Ritor1
parents:
diff changeset
7315 }
Ritor1
parents:
diff changeset
7316 }
Ritor1
parents:
diff changeset
7317 else
Ritor1
parents:
diff changeset
7318 {
Ritor1
parents:
diff changeset
7319 int randVal = rand() % 4;
Ritor1
parents:
diff changeset
7320 switch (randVal)
Ritor1
parents:
diff changeset
7321 {
Ritor1
parents:
diff changeset
7322 case 0 : soundToPlay = (SoundID)105; break;
Ritor1
parents:
diff changeset
7323 case 1 : soundToPlay = (SoundID)106; break;
Ritor1
parents:
diff changeset
7324 case 2 : soundToPlay = (SoundID)107; break;
Ritor1
parents:
diff changeset
7325 case 3 : soundToPlay = (SoundID)45; break;
Ritor1
parents:
diff changeset
7326 default: Error("Unexpected sound value");
Ritor1
parents:
diff changeset
7327 }
Ritor1
parents:
diff changeset
7328 }
Ritor1
parents:
diff changeset
7329 pAudioPlayer->PlaySound(soundToPlay, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0);
Ritor1
parents:
diff changeset
7330 int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
Ritor1
parents:
diff changeset
7331 if ( actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7332 {
Ritor1
parents:
diff changeset
7333 __int16 spellPower = actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
Ritor1
parents:
diff changeset
7334 if ( spellPower )
Ritor1
parents:
diff changeset
7335 dmgToReceive /= (signed int)spellPower;
Ritor1
parents:
diff changeset
7336 }
Ritor1
parents:
diff changeset
7337 int damageType;
Ritor1
parents:
diff changeset
7338 switch (dmgSource)
Ritor1
parents:
diff changeset
7339 {
Ritor1
parents:
diff changeset
7340 case 0: damageType = actorPtr->pMonsterInfo.uAttack1Type;
Ritor1
parents:
diff changeset
7341 break;
Ritor1
parents:
diff changeset
7342 case 1: damageType = actorPtr->pMonsterInfo.uAttack2Type;
Ritor1
parents:
diff changeset
7343 break;
Ritor1
parents:
diff changeset
7344 case 2: spellId = actorPtr->pMonsterInfo.uSpell1ID;
Ritor1
parents:
diff changeset
7345 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7346 break;
Ritor1
parents:
diff changeset
7347 case 3: spellId = actorPtr->pMonsterInfo.uSpell2ID;
Ritor1
parents:
diff changeset
7348 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7349 break;
Ritor1
parents:
diff changeset
7350 case 4: damageType = actorPtr->pMonsterInfo.field_3C_some_special_attack;
Ritor1
parents:
diff changeset
7351 break;
Ritor1
parents:
diff changeset
7352 default:
Ritor1
parents:
diff changeset
7353 case 5: damageType = 4; //yes, the original just assigned the value 4
Ritor1
parents:
diff changeset
7354 break;
Ritor1
parents:
diff changeset
7355 }
Ritor1
parents:
diff changeset
7356 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
Ritor1
parents:
diff changeset
7357 {
Ritor1
parents:
diff changeset
7358 dmgToReceive = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
Ritor1
parents:
diff changeset
7359 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7360 {
Ritor1
parents:
diff changeset
7361 int actorState = actorPtr->uAIState;
Ritor1
parents:
diff changeset
7362 if ( actorState != Dying && actorState != Dead)
Ritor1
parents:
diff changeset
7363 {
Ritor1
parents:
diff changeset
7364 int reflectedDamage = actorPtr->CalcMagicalDamageToActor((DAMAGE_TYPE)damageType, dmgToReceive);
Ritor1
parents:
diff changeset
7365 actorPtr->sCurrentHP -= reflectedDamage;
Ritor1
parents:
diff changeset
7366 if ( reflectedDamage >= 0 )
Ritor1
parents:
diff changeset
7367 {
Ritor1
parents:
diff changeset
7368 if ( actorPtr->sCurrentHP >= 1 )
Ritor1
parents:
diff changeset
7369 {
Ritor1
parents:
diff changeset
7370 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); //todo extract this branch to a function once Actor::functions are changed to nonstatic actor functions
Ritor1
parents:
diff changeset
7371 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7372 }
Ritor1
parents:
diff changeset
7373 else
Ritor1
parents:
diff changeset
7374 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7375 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS)
2498
Ritor1
parents:
diff changeset
7376 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7377 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
2498
Ritor1
parents:
diff changeset
7378 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
Ritor1
parents:
diff changeset
7379 }
Ritor1
parents:
diff changeset
7380 Actor::Die(uActorID);
Ritor1
parents:
diff changeset
7381 Actor::ApplyFineForKillingPeasant(uActorID);
Ritor1
parents:
diff changeset
7382 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7383 if ( actorPtr->pMonsterInfo.uExp )
Ritor1
parents:
diff changeset
7384 pParty->GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp);
Ritor1
parents:
diff changeset
7385 int speechToPlay = SPEECH_51;
Ritor1
parents:
diff changeset
7386 if ( rand() % 100 < 20 )
Ritor1
parents:
diff changeset
7387 speechToPlay = actorPtr->pMonsterInfo.uHP >= 100 ? 2 : 1;
Ritor1
parents:
diff changeset
7388 playerPtr->PlaySound((PlayerSpeech)speechToPlay, 0);
Ritor1
parents:
diff changeset
7389 }
Ritor1
parents:
diff changeset
7390 }
Ritor1
parents:
diff changeset
7391 }
Ritor1
parents:
diff changeset
7392 }
Ritor1
parents:
diff changeset
7393 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
Ritor1
parents:
diff changeset
7394 && actorPtr->pMonsterInfo.uSpecialAttackType
Ritor1
parents:
diff changeset
7395 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
Ritor1
parents:
diff changeset
7396 {
Ritor1
parents:
diff changeset
7397 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
Ritor1
parents:
diff changeset
7398 }
Ritor1
parents:
diff changeset
7399 }
Ritor1
parents:
diff changeset
7400 if ( !pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
7401 {
Ritor1
parents:
diff changeset
7402 int actEndurance = playerPtr->GetActualEndurance();
Ritor1
parents:
diff changeset
7403 int recoveryTime = (int)((20 - playerPtr->GetParameterBonus(actEndurance)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333);
Ritor1
parents:
diff changeset
7404 playerPtr->SetRecoveryTime(recoveryTime);
Ritor1
parents:
diff changeset
7405 }
Ritor1
parents:
diff changeset
7406 int yellThreshold = playerPtr->GetMaxHealth() / 4;
Ritor1
parents:
diff changeset
7407 if ( yellThreshold < playerPtr->sHealth && yellThreshold >= healthBeforeRecvdDamage && playerPtr->sHealth > 0 )
Ritor1
parents:
diff changeset
7408 {
Ritor1
parents:
diff changeset
7409 playerPtr->PlaySound(SPEECH_48, 0);
Ritor1
parents:
diff changeset
7410 }
Ritor1
parents:
diff changeset
7411 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
7412 return;
Ritor1
parents:
diff changeset
7413 }
Ritor1
parents:
diff changeset
7414 else
Ritor1
parents:
diff changeset
7415 {
Ritor1
parents:
diff changeset
7416 SpriteObject* v37 = &pSpriteObjects[uActorID];
Ritor1
parents:
diff changeset
7417 int uActorType = PID_TYPE(v37->spell_caster_pid);
Ritor1
parents:
diff changeset
7418 int uActorID = PID_ID(v37->spell_caster_pid);
Ritor1
parents:
diff changeset
7419 if ( uActorType == 2 )
Ritor1
parents:
diff changeset
7420 {
Ritor1
parents:
diff changeset
7421 Player *playerPtr; // eax@81
Ritor1
parents:
diff changeset
7422 if ( a4 != -1 )
Ritor1
parents:
diff changeset
7423 {
Ritor1
parents:
diff changeset
7424 playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7425 }
Ritor1
parents:
diff changeset
7426 else
Ritor1
parents:
diff changeset
7427 {
Ritor1
parents:
diff changeset
7428 int activePlayerCounter = 0;
Ritor1
parents:
diff changeset
7429 for (int i = 1; i <= 4; i++)
Ritor1
parents:
diff changeset
7430 {
Ritor1
parents:
diff changeset
7431 if (pPlayers[i]->CanAct())
Ritor1
parents:
diff changeset
7432 {
Ritor1
parents:
diff changeset
7433 v72[activePlayerCounter] = i;
Ritor1
parents:
diff changeset
7434 activePlayerCounter++;
Ritor1
parents:
diff changeset
7435 }
Ritor1
parents:
diff changeset
7436 }
Ritor1
parents:
diff changeset
7437 if ( activePlayerCounter )
Ritor1
parents:
diff changeset
7438 {
Ritor1
parents:
diff changeset
7439 playerPtr = &pParty->pPlayers[v72[rand() % activePlayerCounter] - 1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552];
Ritor1
parents:
diff changeset
7440 }
Ritor1
parents:
diff changeset
7441 }
Ritor1
parents:
diff changeset
7442 int v68;
Ritor1
parents:
diff changeset
7443 int v69;
Ritor1
parents:
diff changeset
7444 if ( uActorType != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW)
Ritor1
parents:
diff changeset
7445 {
Ritor1
parents:
diff changeset
7446 int playerMaxHp = playerPtr->GetMaxHealth();
Ritor1
parents:
diff changeset
7447 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, playerMaxHp);
Ritor1
parents:
diff changeset
7448 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool);
Ritor1
parents:
diff changeset
7449 }
Ritor1
parents:
diff changeset
7450 else
Ritor1
parents:
diff changeset
7451 {
Ritor1
parents:
diff changeset
7452 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0);
Ritor1
parents:
diff changeset
7453 v69 = 0;
Ritor1
parents:
diff changeset
7454 }
Ritor1
parents:
diff changeset
7455 playerPtr->ReceiveDamage(v68, (DAMAGE_TYPE)v69);
Ritor1
parents:
diff changeset
7456 if ( uActorType == OBJECT_Player && !_A750D8_player_speech_timer )
Ritor1
parents:
diff changeset
7457 {
Ritor1
parents:
diff changeset
7458 _A750D8_player_speech_timer = 256i64;
Ritor1
parents:
diff changeset
7459 PlayerSpeechID = SPEECH_44;
Ritor1
parents:
diff changeset
7460 uSpeakingCharacter = uActorID + 1;
Ritor1
parents:
diff changeset
7461 }
Ritor1
parents:
diff changeset
7462 return;
Ritor1
parents:
diff changeset
7463 }
Ritor1
parents:
diff changeset
7464 else if ( uActorType == 3 )
Ritor1
parents:
diff changeset
7465 {
Ritor1
parents:
diff changeset
7466 Actor *actorPtr = &pActors[uActorID];
Ritor1
parents:
diff changeset
7467 if ( a4 == -1 )
Ritor1
parents:
diff changeset
7468 a4 = stru_50C198.which_player_to_attack(actorPtr);
Ritor1
parents:
diff changeset
7469 Player *playerPtr = &pParty->pPlayers[a4];
Ritor1
parents:
diff changeset
7470 int dmgToReceive = actorPtr->_43B3E0_CalcDamage(dmgSource);
Ritor1
parents:
diff changeset
7471 unsigned __int16 spriteType = v37->uType;
Ritor1
parents:
diff changeset
7472 if ( v37->uType == 545 )
Ritor1
parents:
diff changeset
7473 {
Ritor1
parents:
diff changeset
7474 __int16 skillLevel = playerPtr->GetActualSkillLevel(PLAYER_SKILL_UNARMED);
Ritor1
parents:
diff changeset
7475 if ( SkillToMastery(skillLevel) >= 4 && rand() % 100 < (skillLevel & 0x3F) )
Ritor1
parents:
diff changeset
7476 {
Ritor1
parents:
diff changeset
7477 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], playerPtr->pName);
Ritor1
parents:
diff changeset
7478 ShowStatusBarString(pTmpBuf.data(), 2u);
Ritor1
parents:
diff changeset
7479 playerPtr->PlaySound(SPEECH_6, 0);
Ritor1
parents:
diff changeset
7480 return;
Ritor1
parents:
diff changeset
7481 }
Ritor1
parents:
diff changeset
7482 }
Ritor1
parents:
diff changeset
7483 else if ( spriteType == 555
Ritor1
parents:
diff changeset
7484 || spriteType == 510
Ritor1
parents:
diff changeset
7485 || spriteType == 500
Ritor1
parents:
diff changeset
7486 || spriteType == 515
Ritor1
parents:
diff changeset
7487 || spriteType == 505
Ritor1
parents:
diff changeset
7488 || spriteType == 530
Ritor1
parents:
diff changeset
7489 || spriteType == 525
Ritor1
parents:
diff changeset
7490 || spriteType == 520
Ritor1
parents:
diff changeset
7491 || spriteType == 535
Ritor1
parents:
diff changeset
7492 || spriteType == 540 )
Ritor1
parents:
diff changeset
7493 {
Ritor1
parents:
diff changeset
7494 if ( !actorPtr->ActorHitOrMiss(playerPtr) )
Ritor1
parents:
diff changeset
7495 return;
Ritor1
parents:
diff changeset
7496 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7497 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7498 if ( playerPtr->HasEnchantedItemEquipped(36) )
Ritor1
parents:
diff changeset
7499 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7500 if ( playerPtr->HasEnchantedItemEquipped(69) )
Ritor1
parents:
diff changeset
7501 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7502 if ( playerPtr->HasItemEquipped(EQUIP_ARMOUR)
Ritor1
parents:
diff changeset
7503 && playerPtr->GetArmorItem()->uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR )
Ritor1
parents:
diff changeset
7504 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7505 if ( playerPtr->HasItemEquipped(EQUIP_TWO_HANDED))
Ritor1
parents:
diff changeset
7506 {
Ritor1
parents:
diff changeset
7507 ItemGen* mainHandItem = playerPtr->GetMainHandItem();
Ritor1
parents:
diff changeset
7508 if ( mainHandItem->uItemID == ITEM_RELIC_KELEBRIM || mainHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (mainHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
Ritor1
parents:
diff changeset
7509 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7510 }
Ritor1
parents:
diff changeset
7511 if ( playerPtr->HasItemEquipped(EQUIP_SINGLE_HANDED))
Ritor1
parents:
diff changeset
7512 {
Ritor1
parents:
diff changeset
7513 ItemGen* offHandItem = playerPtr->GetOffHandItem();
Ritor1
parents:
diff changeset
7514 if ( offHandItem->uItemID == ITEM_RELIC_KELEBRIM || offHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (offHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4))
Ritor1
parents:
diff changeset
7515 dmgToReceive >>= 1;
Ritor1
parents:
diff changeset
7516 }
Ritor1
parents:
diff changeset
7517 }
Ritor1
parents:
diff changeset
7518 if ( actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7519 {
Ritor1
parents:
diff changeset
7520 int spellPower = actorPtr->pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
Ritor1
parents:
diff changeset
7521 if ( spellPower )
Ritor1
parents:
diff changeset
7522 dmgToReceive /= (signed int)spellPower;
Ritor1
parents:
diff changeset
7523 }
Ritor1
parents:
diff changeset
7524 int damageType;
Ritor1
parents:
diff changeset
7525 switch(dmgSource)
Ritor1
parents:
diff changeset
7526 {
Ritor1
parents:
diff changeset
7527 case 0:
Ritor1
parents:
diff changeset
7528 damageType = actorPtr->pMonsterInfo.uAttack1Type;
Ritor1
parents:
diff changeset
7529 break;
Ritor1
parents:
diff changeset
7530 case 1:
Ritor1
parents:
diff changeset
7531 damageType = actorPtr->pMonsterInfo.uAttack2Type;
Ritor1
parents:
diff changeset
7532 break;
Ritor1
parents:
diff changeset
7533 case 2:
Ritor1
parents:
diff changeset
7534 spellId = actorPtr->pMonsterInfo.uSpell1ID;
Ritor1
parents:
diff changeset
7535 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7536 break;
Ritor1
parents:
diff changeset
7537 case 3:
Ritor1
parents:
diff changeset
7538 spellId = actorPtr->pMonsterInfo.uSpell2ID;
Ritor1
parents:
diff changeset
7539 damageType = LOBYTE(pSpellStats->pInfos[spellId].uSchool);
Ritor1
parents:
diff changeset
7540 break;
Ritor1
parents:
diff changeset
7541 case 4:
Ritor1
parents:
diff changeset
7542 damageType = actorPtr->pMonsterInfo.field_3C_some_special_attack;
Ritor1
parents:
diff changeset
7543 break;
Ritor1
parents:
diff changeset
7544 case 5:
Ritor1
parents:
diff changeset
7545 damageType = 4;
Ritor1
parents:
diff changeset
7546 break;
Ritor1
parents:
diff changeset
7547 }
Ritor1
parents:
diff changeset
7548 if ( !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE) )
Ritor1
parents:
diff changeset
7549 {
Ritor1
parents:
diff changeset
7550 int reflectedDmg = playerPtr->ReceiveDamage(dmgToReceive, (DAMAGE_TYPE)damageType);
Ritor1
parents:
diff changeset
7551 if ( playerPtr->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7552 {
Ritor1
parents:
diff changeset
7553 unsigned __int16 actorState = actorPtr->uAIState;
Ritor1
parents:
diff changeset
7554 if ( actorState != Dying && actorState != Dead)
Ritor1
parents:
diff changeset
7555 {
Ritor1
parents:
diff changeset
7556 recvdMagicDmg = actorPtr->CalcMagicalDamageToActor((DAMAGE_TYPE)damageType, reflectedDmg);
Ritor1
parents:
diff changeset
7557 actorPtr->sCurrentHP -= recvdMagicDmg;
Ritor1
parents:
diff changeset
7558 if ( recvdMagicDmg >= 0 )
Ritor1
parents:
diff changeset
7559 {
Ritor1
parents:
diff changeset
7560 if ( actorPtr->sCurrentHP >= 1 )
Ritor1
parents:
diff changeset
7561 {
Ritor1
parents:
diff changeset
7562 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0);
Ritor1
parents:
diff changeset
7563 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7564 }
Ritor1
parents:
diff changeset
7565 else
Ritor1
parents:
diff changeset
7566 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7567 if ( pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].bQuestMonster & 1 && pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
2498
Ritor1
parents:
diff changeset
7568 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7569 int splatRadius = byte_4D864C && BYTE2(pEngine->uFlags) & 8 ? 10 * actorPtr->uActorRadius : actorPtr->uActorRadius;
2498
Ritor1
parents:
diff changeset
7570 pDecalBuilder->AddBloodsplat(actorPtr->vPosition.x, actorPtr->vPosition.y, actorPtr->vPosition.z, 1.0, 0.0, 0.0, (float)splatRadius, 0, 0);
Ritor1
parents:
diff changeset
7571 }
Ritor1
parents:
diff changeset
7572 Actor::Die(uActorID);
Ritor1
parents:
diff changeset
7573 Actor::ApplyFineForKillingPeasant(uActorID);
Ritor1
parents:
diff changeset
7574 Actor::AggroSurroundingPeasants(uActorID, 1);
Ritor1
parents:
diff changeset
7575 if ( actorPtr->pMonsterInfo.uExp )
Ritor1
parents:
diff changeset
7576 pParty->GivePartyExp(pMonsterStats->pInfos[actorPtr->pMonsterInfo.uID].uExp);
Ritor1
parents:
diff changeset
7577 int speechToPlay = SPEECH_51;
Ritor1
parents:
diff changeset
7578 if ( rand() % 100 < 20 )
Ritor1
parents:
diff changeset
7579 speechToPlay = actorPtr->pMonsterInfo.uHP >= 100 ? 2 : 1;
Ritor1
parents:
diff changeset
7580 playerPtr->PlaySound((PlayerSpeech)speechToPlay, 0);
Ritor1
parents:
diff changeset
7581 }
Ritor1
parents:
diff changeset
7582 }
Ritor1
parents:
diff changeset
7583 }
Ritor1
parents:
diff changeset
7584 }
Ritor1
parents:
diff changeset
7585 }
Ritor1
parents:
diff changeset
7586 if ( !dmgSource
Ritor1
parents:
diff changeset
7587 && !(dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DAMAGE)
Ritor1
parents:
diff changeset
7588 && actorPtr->pMonsterInfo.uSpecialAttackType
Ritor1
parents:
diff changeset
7589 && rand() % 100 < actorPtr->pMonsterInfo.uLevel * actorPtr->pMonsterInfo.uSpecialAttackLevel )
Ritor1
parents:
diff changeset
7590 {
Ritor1
parents:
diff changeset
7591 playerPtr->ReceiveSpecialAttackEffect(actorPtr->pMonsterInfo.uSpecialAttackType, actorPtr);
Ritor1
parents:
diff changeset
7592 }
Ritor1
parents:
diff changeset
7593 if ( !pParty->bTurnBasedModeOn )
Ritor1
parents:
diff changeset
7594 {
Ritor1
parents:
diff changeset
7595 int actEnd = playerPtr->GetActualEndurance();
Ritor1
parents:
diff changeset
7596 int recTime = (int)((20 - playerPtr->GetParameterBonus(actEnd))
Ritor1
parents:
diff changeset
7597 * flt_6BE3A4_debug_recmod1
Ritor1
parents:
diff changeset
7598 * 2.133333333333333);
Ritor1
parents:
diff changeset
7599 playerPtr->SetRecoveryTime(recTime);
Ritor1
parents:
diff changeset
7600 }
Ritor1
parents:
diff changeset
7601 return;
Ritor1
parents:
diff changeset
7602 }
Ritor1
parents:
diff changeset
7603 else
Ritor1
parents:
diff changeset
7604 {
Ritor1
parents:
diff changeset
7605 return;
Ritor1
parents:
diff changeset
7606 }
Ritor1
parents:
diff changeset
7607 }
Ritor1
parents:
diff changeset
7608 }
Ritor1
parents:
diff changeset
7609 //----- (00421EA6) --------------------------------------------------------
Ritor1
parents:
diff changeset
7610 void Player::OnInventoryLeftClick()
Ritor1
parents:
diff changeset
7611 {
Ritor1
parents:
diff changeset
7612 signed int inventoryXCoord; // ecx@2
Ritor1
parents:
diff changeset
7613 int inventoryYCoord; // eax@2
Ritor1
parents:
diff changeset
7614 int invMatrixIndex; // eax@2
Ritor1
parents:
diff changeset
7615 unsigned int enchantedItemPos; // eax@7
Ritor1
parents:
diff changeset
7616 unsigned int pickedItemId; // esi@12
Ritor1
parents:
diff changeset
7617 unsigned int invItemIndex; // eax@12
Ritor1
parents:
diff changeset
7618 unsigned int itemPos; // eax@18
Ritor1
parents:
diff changeset
7619 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1
Ritor1
parents:
diff changeset
7620 unsigned int pY; // [sp+3Ch] [bp-Ch]@2
Ritor1
parents:
diff changeset
7621 unsigned int pX; // [sp+40h] [bp-8h]@2
Ritor1
parents:
diff changeset
7622 CastSpellInfo *pSpellInfo;
Ritor1
parents:
diff changeset
7623
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2543
diff changeset
7624 if (current_character_screen_window == WINDOW_CharacterWindow_Inventory)
2498
Ritor1
parents:
diff changeset
7625 {
Ritor1
parents:
diff changeset
7626 pMouse->GetClickPos(&pX, &pY);
Ritor1
parents:
diff changeset
7627 inventoryYCoord = (pY - 17) / 32;
Ritor1
parents:
diff changeset
7628 inventoryXCoord = (pX - 14) / 32;
Ritor1
parents:
diff changeset
7629 invMatrixIndex = inventoryXCoord + (INVETORYSLOTSWIDTH * inventoryYCoord);
Ritor1
parents:
diff changeset
7630 if ( inventoryYCoord >= 0 && inventoryYCoord < INVETORYSLOTSHEIGHT && inventoryXCoord >= 0 && inventoryXCoord < INVETORYSLOTSWIDTH)
Ritor1
parents:
diff changeset
7631 {
Ritor1
parents:
diff changeset
7632 if ( _50C9A0_IsEnchantingInProgress )
Ritor1
parents:
diff changeset
7633 {
Ritor1
parents:
diff changeset
7634 enchantedItemPos = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
Ritor1
parents:
diff changeset
7635 if ( enchantedItemPos )
Ritor1
parents:
diff changeset
7636 {
2554
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7637 /* *((char *)pGUIWindow_CastTargetedSpell->ptr_1C + 8) &= 0x7Fu;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7638 *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 2) = uActiveCharacter - 1;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7639 *((int *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = enchantedItemPos - 1;
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7640 *((short *)pGUIWindow_CastTargetedSpell->ptr_1C + 3) = invMatrixIndex;*/
f2a8ed07e921 Game Main Menu separated from Game logic
a.parshin
parents: 2544
diff changeset
7641 pSpellInfo = (CastSpellInfo *)pGUIWindow_CastTargetedSpell->ptr_1C;
2498
Ritor1
parents:
diff changeset
7642 pSpellInfo->uFlags &= 0x7F;
Ritor1
parents:
diff changeset
7643 pSpellInfo->uPlayerID_2 = uActiveCharacter - 1;
Ritor1
parents:
diff changeset
7644 pSpellInfo->spell_target_pid = enchantedItemPos - 1;
Ritor1
parents:
diff changeset
7645 pSpellInfo->field_6 = invMatrixIndex;
Ritor1
parents:
diff changeset
7646 ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[enchantedItemPos-1];
Ritor1
parents:
diff changeset
7647 _50C9A0_IsEnchantingInProgress = 0;
Ritor1
parents:
diff changeset
7648 if ( pMessageQueue_50CBD0->uNumMessages )
Ritor1
parents:
diff changeset
7649 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
Ritor1
parents:
diff changeset
7650 pMouse->SetCursorBitmap("MICON1");
Ritor1
parents:
diff changeset
7651 _50C9D0_AfterEnchClickEventId = 113;
Ritor1
parents:
diff changeset
7652 _50C9D4_AfterEnchClickEventSecondParam = 0;
Ritor1
parents:
diff changeset
7653 _50C9D8_AfterEnchClickEventTimeout = 256;
Ritor1
parents:
diff changeset
7654 }
Ritor1
parents:
diff changeset
7655 return;
Ritor1
parents:
diff changeset
7656 }
Ritor1
parents:
diff changeset
7657 if ( ptr_50C9A4_ItemToEnchant )
Ritor1
parents:
diff changeset
7658 return;
Ritor1
parents:
diff changeset
7659 pickedItemId = pParty->pPickedItem.uItemID;
Ritor1
parents:
diff changeset
7660 invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
Ritor1
parents:
diff changeset
7661 if (!pickedItemId)
Ritor1
parents:
diff changeset
7662 {
Ritor1
parents:
diff changeset
7663 if ( !invItemIndex )
Ritor1
parents:
diff changeset
7664 return;
Ritor1
parents:
diff changeset
7665 else
Ritor1
parents:
diff changeset
7666 {
Ritor1
parents:
diff changeset
7667 memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem));
Ritor1
parents:
diff changeset
7668 this->RemoveItemAtInventoryIndex(invMatrixIndex);
Ritor1
parents:
diff changeset
7669 pickedItemId = pParty->pPickedItem.uItemID;
Ritor1
parents:
diff changeset
7670 pMouse->SetCursorBitmap(pItemsTable->pItems[pickedItemId].pIconName);
Ritor1
parents:
diff changeset
7671 return;
Ritor1
parents:
diff changeset
7672 }
Ritor1
parents:
diff changeset
7673 }
Ritor1
parents:
diff changeset
7674 else
Ritor1
parents:
diff changeset
7675 {
Ritor1
parents:
diff changeset
7676 if ( invItemIndex )
Ritor1
parents:
diff changeset
7677 {
Ritor1
parents:
diff changeset
7678 ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1];
Ritor1
parents:
diff changeset
7679 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem));
Ritor1
parents:
diff changeset
7680 this->RemoveItemAtInventoryIndex(invMatrixIndex);
Ritor1
parents:
diff changeset
7681 int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem);
Ritor1
parents:
diff changeset
7682 if ( !emptyIndex )
Ritor1
parents:
diff changeset
7683 {
Ritor1
parents:
diff changeset
7684 emptyIndex = this->AddItem2(-1, &pParty->pPickedItem);
Ritor1
parents:
diff changeset
7685 if ( !emptyIndex )
Ritor1
parents:
diff changeset
7686 {
Ritor1
parents:
diff changeset
7687 this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex);
Ritor1
parents:
diff changeset
7688 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7689 return;
Ritor1
parents:
diff changeset
7690 }
Ritor1
parents:
diff changeset
7691 }
Ritor1
parents:
diff changeset
7692 memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7693 pMouse->SetCursorBitmap(pParty->pPickedItem.GetIconName());
Ritor1
parents:
diff changeset
7694 return;
Ritor1
parents:
diff changeset
7695 }
Ritor1
parents:
diff changeset
7696 else
Ritor1
parents:
diff changeset
7697 {
Ritor1
parents:
diff changeset
7698 itemPos = this->AddItem(invMatrixIndex, pickedItemId);
Ritor1
parents:
diff changeset
7699 if ( itemPos )
Ritor1
parents:
diff changeset
7700 {
Ritor1
parents:
diff changeset
7701 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7702 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7703 return;
Ritor1
parents:
diff changeset
7704 }
Ritor1
parents:
diff changeset
7705 itemPos = this->AddItem(-1, pickedItemId);
Ritor1
parents:
diff changeset
7706 if ( itemPos )
Ritor1
parents:
diff changeset
7707 {
Ritor1
parents:
diff changeset
7708 memcpy(&this->pInventoryItemList[itemPos-1], &pParty->pPickedItem, sizeof(ItemGen));
Ritor1
parents:
diff changeset
7709 pMouse->RemoveHoldingItem();
Ritor1
parents:
diff changeset
7710 return;
Ritor1
parents:
diff changeset
7711 }
Ritor1
parents:
diff changeset
7712 }
Ritor1
parents:
diff changeset
7713 }
Ritor1
parents:
diff changeset
7714 }
Ritor1
parents:
diff changeset
7715 }
Ritor1
parents:
diff changeset
7716 }
Ritor1
parents:
diff changeset
7717
Ritor1
parents:
diff changeset
7718
Ritor1
parents:
diff changeset
7719 bool Player::IsWeak()
Ritor1
parents:
diff changeset
7720 {
Ritor1
parents:
diff changeset
7721 return pConditions[Condition_Weak] != 0;
Ritor1
parents:
diff changeset
7722 }
Ritor1
parents:
diff changeset
7723
Ritor1
parents:
diff changeset
7724 bool Player::IsDead()
Ritor1
parents:
diff changeset
7725 {
Ritor1
parents:
diff changeset
7726 return pConditions[Condition_Dead] != 0;
Ritor1
parents:
diff changeset
7727 }
Ritor1
parents:
diff changeset
7728
Ritor1
parents:
diff changeset
7729 bool Player::IsEradicated()
Ritor1
parents:
diff changeset
7730 {
Ritor1
parents:
diff changeset
7731 return pConditions[Condition_Eradicated] != 0;
Ritor1
parents:
diff changeset
7732 }
Ritor1
parents:
diff changeset
7733
Ritor1
parents:
diff changeset
7734 bool Player::IsZombie()
Ritor1
parents:
diff changeset
7735 {
Ritor1
parents:
diff changeset
7736 return pConditions[Condition_Zombie] != 0;
Ritor1
parents:
diff changeset
7737 }
Ritor1
parents:
diff changeset
7738
Ritor1
parents:
diff changeset
7739 bool Player::IsCursed()
Ritor1
parents:
diff changeset
7740 {
Ritor1
parents:
diff changeset
7741 return pConditions[Condition_Cursed] != 0;
Ritor1
parents:
diff changeset
7742 }
Ritor1
parents:
diff changeset
7743
Ritor1
parents:
diff changeset
7744 bool Player::IsPertified()
Ritor1
parents:
diff changeset
7745 {
Ritor1
parents:
diff changeset
7746 return pConditions[Condition_Pertified] != 0;
Ritor1
parents:
diff changeset
7747 }
Ritor1
parents:
diff changeset
7748
Ritor1
parents:
diff changeset
7749 bool Player::IsUnconcious()
Ritor1
parents:
diff changeset
7750 {
Ritor1
parents:
diff changeset
7751 return pConditions[Condition_Unconcious] != 0;
Ritor1
parents:
diff changeset
7752 }
Ritor1
parents:
diff changeset
7753
Ritor1
parents:
diff changeset
7754 bool Player::IsAsleep()
Ritor1
parents:
diff changeset
7755 {
Ritor1
parents:
diff changeset
7756 return pConditions[Condition_Sleep] != 0;
Ritor1
parents:
diff changeset
7757 }
Ritor1
parents:
diff changeset
7758
Ritor1
parents:
diff changeset
7759 bool Player::IsParalyzed()
Ritor1
parents:
diff changeset
7760 {
Ritor1
parents:
diff changeset
7761 return pConditions[Condition_Paralyzed] != 0;
Ritor1
parents:
diff changeset
7762 }
Ritor1
parents:
diff changeset
7763
Ritor1
parents:
diff changeset
7764 bool Player::IsDrunk()
Ritor1
parents:
diff changeset
7765 {
Ritor1
parents:
diff changeset
7766 return pConditions[Condition_Drunk] != 0;
Ritor1
parents:
diff changeset
7767 }
Ritor1
parents:
diff changeset
7768
Ritor1
parents:
diff changeset
7769 void Player::SetCursed( unsigned long long state )
Ritor1
parents:
diff changeset
7770 {
Ritor1
parents:
diff changeset
7771 pConditions[Condition_Cursed] = state;
Ritor1
parents:
diff changeset
7772 }
Ritor1
parents:
diff changeset
7773
Ritor1
parents:
diff changeset
7774 void Player::SetWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7775 {
Ritor1
parents:
diff changeset
7776 pConditions[Condition_Weak] = state;
Ritor1
parents:
diff changeset
7777 }
Ritor1
parents:
diff changeset
7778
Ritor1
parents:
diff changeset
7779 void Player::SetAsleep( unsigned long long state )
Ritor1
parents:
diff changeset
7780 {
Ritor1
parents:
diff changeset
7781 pConditions[Condition_Sleep] = state;
Ritor1
parents:
diff changeset
7782 }
Ritor1
parents:
diff changeset
7783
Ritor1
parents:
diff changeset
7784 void Player::SetAfraid( unsigned long long state )
Ritor1
parents:
diff changeset
7785 {
Ritor1
parents:
diff changeset
7786 pConditions[Condition_Fear] = state;
Ritor1
parents:
diff changeset
7787 }
Ritor1
parents:
diff changeset
7788
Ritor1
parents:
diff changeset
7789 void Player::SetDrunk( unsigned long long state )
Ritor1
parents:
diff changeset
7790 {
Ritor1
parents:
diff changeset
7791 pConditions[Condition_Drunk] = state;
Ritor1
parents:
diff changeset
7792 }
Ritor1
parents:
diff changeset
7793
Ritor1
parents:
diff changeset
7794 void Player::SetInsane( unsigned long long state )
Ritor1
parents:
diff changeset
7795 {
Ritor1
parents:
diff changeset
7796 pConditions[Condition_Insane] = state;
Ritor1
parents:
diff changeset
7797 }
Ritor1
parents:
diff changeset
7798
Ritor1
parents:
diff changeset
7799 void Player::SetPoisonWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7800 {
Ritor1
parents:
diff changeset
7801 pConditions[Condition_Poison_Weak] = state;
Ritor1
parents:
diff changeset
7802 }
Ritor1
parents:
diff changeset
7803
Ritor1
parents:
diff changeset
7804 void Player::SetDiseaseWeak( unsigned long long state )
Ritor1
parents:
diff changeset
7805 {
Ritor1
parents:
diff changeset
7806 pConditions[Condition_Disease_Weak] = state;
Ritor1
parents:
diff changeset
7807 }
Ritor1
parents:
diff changeset
7808
Ritor1
parents:
diff changeset
7809 void Player::SetPoisonMedium( unsigned long long state )
Ritor1
parents:
diff changeset
7810 {
Ritor1
parents:
diff changeset
7811 pConditions[Condition_Poison_Medium] = state;
Ritor1
parents:
diff changeset
7812 }
Ritor1
parents:
diff changeset
7813
Ritor1
parents:
diff changeset
7814 void Player::SetDiseaseMedium( unsigned long long state )
Ritor1
parents:
diff changeset
7815 {
Ritor1
parents:
diff changeset
7816 pConditions[Condition_Disease_Medium] = state;
Ritor1
parents:
diff changeset
7817 }
Ritor1
parents:
diff changeset
7818
Ritor1
parents:
diff changeset
7819 void Player::SetPoisonSevere( unsigned long long state )
Ritor1
parents:
diff changeset
7820 {
Ritor1
parents:
diff changeset
7821 pConditions[Condition_Poison_Severe] = state;
Ritor1
parents:
diff changeset
7822 }
Ritor1
parents:
diff changeset
7823
Ritor1
parents:
diff changeset
7824 void Player::SetDiseaseSevere( unsigned long long state )
Ritor1
parents:
diff changeset
7825 {
Ritor1
parents:
diff changeset
7826 pConditions[Condition_Disease_Severe] = state;
Ritor1
parents:
diff changeset
7827 }
Ritor1
parents:
diff changeset
7828
Ritor1
parents:
diff changeset
7829 void Player::SetParalyzed( unsigned long long state )
Ritor1
parents:
diff changeset
7830 {
Ritor1
parents:
diff changeset
7831 pConditions[Condition_Paralyzed] = state;
Ritor1
parents:
diff changeset
7832 }
Ritor1
parents:
diff changeset
7833
Ritor1
parents:
diff changeset
7834 void Player::SetUnconcious( unsigned long long state )
Ritor1
parents:
diff changeset
7835 {
Ritor1
parents:
diff changeset
7836 pConditions[Condition_Unconcious] = state;
Ritor1
parents:
diff changeset
7837 }
Ritor1
parents:
diff changeset
7838
Ritor1
parents:
diff changeset
7839 void Player::SetDead( unsigned long long state )
Ritor1
parents:
diff changeset
7840 {
Ritor1
parents:
diff changeset
7841 pConditions[Condition_Dead] = state;
Ritor1
parents:
diff changeset
7842 }
Ritor1
parents:
diff changeset
7843
Ritor1
parents:
diff changeset
7844 void Player::SetPertified( unsigned long long state )
Ritor1
parents:
diff changeset
7845 {
Ritor1
parents:
diff changeset
7846 pConditions[Condition_Pertified] = state;
Ritor1
parents:
diff changeset
7847 }
Ritor1
parents:
diff changeset
7848
Ritor1
parents:
diff changeset
7849 void Player::SetEradicated( unsigned long long state )
Ritor1
parents:
diff changeset
7850 {
Ritor1
parents:
diff changeset
7851 pConditions[Condition_Eradicated] = state;
Ritor1
parents:
diff changeset
7852 }
Ritor1
parents:
diff changeset
7853
Ritor1
parents:
diff changeset
7854 void Player::SetZombie( unsigned long long state )
Ritor1
parents:
diff changeset
7855 {
Ritor1
parents:
diff changeset
7856 pConditions[Condition_Zombie] = state;
Ritor1
parents:
diff changeset
7857 }
Ritor1
parents:
diff changeset
7858
Ritor1
parents:
diff changeset
7859 void Player::SetCondWeakWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7860 {
Ritor1
parents:
diff changeset
7861 SetCondition(Condition_Weak, blockable);
Ritor1
parents:
diff changeset
7862 }
Ritor1
parents:
diff changeset
7863
Ritor1
parents:
diff changeset
7864 void Player::SetCondInsaneWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7865 {
Ritor1
parents:
diff changeset
7866 SetCondition(Condition_Insane, blockable);
Ritor1
parents:
diff changeset
7867 }
Ritor1
parents:
diff changeset
7868
Ritor1
parents:
diff changeset
7869 void Player::SetCondDeadWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7870 {
Ritor1
parents:
diff changeset
7871 SetCondition(Condition_Dead, blockable);
Ritor1
parents:
diff changeset
7872 }
Ritor1
parents:
diff changeset
7873
Ritor1
parents:
diff changeset
7874 void Player::SetCondUnconsciousWithBlockCheck( int blockable )
Ritor1
parents:
diff changeset
7875 {
Ritor1
parents:
diff changeset
7876 SetCondition(Condition_Dead, blockable);
Ritor1
parents:
diff changeset
7877 }
Ritor1
parents:
diff changeset
7878
Ritor1
parents:
diff changeset
7879 ItemGen* Player::GetOffHandItem()
Ritor1
parents:
diff changeset
7880 {
Ritor1
parents:
diff changeset
7881 return GetItem(&PlayerEquipment::uShield);
Ritor1
parents:
diff changeset
7882 }
Ritor1
parents:
diff changeset
7883
Ritor1
parents:
diff changeset
7884 ItemGen* Player::GetMainHandItem()
Ritor1
parents:
diff changeset
7885 {
Ritor1
parents:
diff changeset
7886 return GetItem(&PlayerEquipment::uMainHand);
Ritor1
parents:
diff changeset
7887 }
Ritor1
parents:
diff changeset
7888
Ritor1
parents:
diff changeset
7889 ItemGen* Player::GetBowItem()
Ritor1
parents:
diff changeset
7890 {
Ritor1
parents:
diff changeset
7891 return GetItem(&PlayerEquipment::uBow);
Ritor1
parents:
diff changeset
7892 }
Ritor1
parents:
diff changeset
7893
Ritor1
parents:
diff changeset
7894 ItemGen* Player::GetArmorItem()
Ritor1
parents:
diff changeset
7895 {
Ritor1
parents:
diff changeset
7896 return GetItem(&PlayerEquipment::uArmor);
Ritor1
parents:
diff changeset
7897 }
Ritor1
parents:
diff changeset
7898
Ritor1
parents:
diff changeset
7899 ItemGen* Player::GetHelmItem()
Ritor1
parents:
diff changeset
7900 {
Ritor1
parents:
diff changeset
7901 return GetItem(&PlayerEquipment::uHelm);
Ritor1
parents:
diff changeset
7902 }
Ritor1
parents:
diff changeset
7903
Ritor1
parents:
diff changeset
7904 ItemGen* Player::GetBeltItem()
Ritor1
parents:
diff changeset
7905 {
Ritor1
parents:
diff changeset
7906 return GetItem(&PlayerEquipment::uBelt);
Ritor1
parents:
diff changeset
7907 }
Ritor1
parents:
diff changeset
7908
Ritor1
parents:
diff changeset
7909 ItemGen* Player::GetCloakItem()
Ritor1
parents:
diff changeset
7910 {
Ritor1
parents:
diff changeset
7911 return GetItem(&PlayerEquipment::uCloak);
Ritor1
parents:
diff changeset
7912 }
Ritor1
parents:
diff changeset
7913
Ritor1
parents:
diff changeset
7914 ItemGen* Player::GetGloveItem()
Ritor1
parents:
diff changeset
7915 {
Ritor1
parents:
diff changeset
7916 return GetItem(&PlayerEquipment::uGlove);
Ritor1
parents:
diff changeset
7917 }
Ritor1
parents:
diff changeset
7918
Ritor1
parents:
diff changeset
7919 ItemGen* Player::GetBootItem()
Ritor1
parents:
diff changeset
7920 {
Ritor1
parents:
diff changeset
7921 return GetItem(&PlayerEquipment::uBoot);
Ritor1
parents:
diff changeset
7922 }
Ritor1
parents:
diff changeset
7923
Ritor1
parents:
diff changeset
7924 ItemGen* Player::GetAmuletItem()
Ritor1
parents:
diff changeset
7925 {
Ritor1
parents:
diff changeset
7926 return GetItem(&PlayerEquipment::uAmulet);
Ritor1
parents:
diff changeset
7927 }
Ritor1
parents:
diff changeset
7928
Ritor1
parents:
diff changeset
7929 ItemGen* Player::GetNthRingItem(int ringNum)
Ritor1
parents:
diff changeset
7930 {
Ritor1
parents:
diff changeset
7931 return GetNthEquippedIndexItem(ringNum + 10);
Ritor1
parents:
diff changeset
7932 }
Ritor1
parents:
diff changeset
7933
Ritor1
parents:
diff changeset
7934 ItemGen* Player::GetNthEquippedIndexItem(int index)
Ritor1
parents:
diff changeset
7935 {
Ritor1
parents:
diff changeset
7936 if (this->pEquipment.pIndices[index] == 0)
Ritor1
parents:
diff changeset
7937 {
Ritor1
parents:
diff changeset
7938 return nullptr;
Ritor1
parents:
diff changeset
7939 }
Ritor1
parents:
diff changeset
7940 return &this->pInventoryItemList[this->pEquipment.pIndices[index] - 1];
Ritor1
parents:
diff changeset
7941 }
Ritor1
parents:
diff changeset
7942
Ritor1
parents:
diff changeset
7943 ItemGen* Player::GetItem(unsigned int PlayerEquipment::* itemPos)
Ritor1
parents:
diff changeset
7944 {
Ritor1
parents:
diff changeset
7945 if (this->pEquipment.*itemPos == 0)
Ritor1
parents:
diff changeset
7946 {
Ritor1
parents:
diff changeset
7947 return nullptr;
Ritor1
parents:
diff changeset
7948 }
Ritor1
parents:
diff changeset
7949 return &this->pInventoryItemList[this->pEquipment.*itemPos - 1];
Ritor1
parents:
diff changeset
7950 }
Ritor1
parents:
diff changeset
7951
Ritor1
parents:
diff changeset
7952 int Player::GetPlayerIndex()
Ritor1
parents:
diff changeset
7953 {
Ritor1
parents:
diff changeset
7954 int uPlayerIdx = 0;
Ritor1
parents:
diff changeset
7955 if ( this == pPlayers[1] )
Ritor1
parents:
diff changeset
7956 uPlayerIdx = 0;
Ritor1
parents:
diff changeset
7957 else if( this == pPlayers[2] )
Ritor1
parents:
diff changeset
7958 uPlayerIdx = 1;
Ritor1
parents:
diff changeset
7959 else if ( this == pPlayers[3] )
Ritor1
parents:
diff changeset
7960 uPlayerIdx = 2;
Ritor1
parents:
diff changeset
7961 else if ( this == pPlayers[4] )
Ritor1
parents:
diff changeset
7962 uPlayerIdx = 3;
Ritor1
parents:
diff changeset
7963 else
Ritor1
parents:
diff changeset
7964 Error("Unexpected player pointer");
Ritor1
parents:
diff changeset
7965 return uPlayerIdx;
Ritor1
parents:
diff changeset
7966 }
Ritor1
parents:
diff changeset
7967
Ritor1
parents:
diff changeset
7968 //----- (004272F5) --------------------------------------------------------
Ritor1
parents:
diff changeset
7969 bool Player::PlayerHitOrMiss(Actor *pActor, int a3, int a4)
Ritor1
parents:
diff changeset
7970 {
Ritor1
parents:
diff changeset
7971 signed int naturalArmor; // esi@1
Ritor1
parents:
diff changeset
7972 signed int armorBuff; // edi@1
Ritor1
parents:
diff changeset
7973 int effectiveActorArmor; // esi@8
Ritor1
parents:
diff changeset
7974 int attBonus; // eax@9
Ritor1
parents:
diff changeset
7975 int v9; // edx@11
Ritor1
parents:
diff changeset
7976 // unsigned __int8 v12; // sf@13
Ritor1
parents:
diff changeset
7977 // unsigned __int8 v13; // of@13
Ritor1
parents:
diff changeset
7978 int attPositiveMod; // edx@14
Ritor1
parents:
diff changeset
7979 int attNegativeMod; // eax@14
Ritor1
parents:
diff changeset
7980 // signed int result; // eax@17
Ritor1
parents:
diff changeset
7981
Ritor1
parents:
diff changeset
7982 naturalArmor = pActor->pMonsterInfo.uAC;
Ritor1
parents:
diff changeset
7983 armorBuff = 0;
Ritor1
parents:
diff changeset
7984 if ( pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7985 naturalArmor /= 2;
Ritor1
parents:
diff changeset
7986 if ( pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
Ritor1
parents:
diff changeset
7987 armorBuff = pActor->pActorBuffs[ACTOR_BUFF_SHIELD].uPower;
Ritor1
parents:
diff changeset
7988 if ( pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uExpireTime > 0 && pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower > armorBuff )
Ritor1
parents:
diff changeset
7989 armorBuff = pActor->pActorBuffs[ACTOR_BUFF_STONESKIN].uPower;
Ritor1
parents:
diff changeset
7990 effectiveActorArmor = armorBuff + naturalArmor;
Ritor1
parents:
diff changeset
7991 if ( a3 )
Ritor1
parents:
diff changeset
7992 attBonus = this->GetRangedAttack();
Ritor1
parents:
diff changeset
7993 else
Ritor1
parents:
diff changeset
7994 attBonus = this->GetActualAttack(false);
Ritor1
parents:
diff changeset
7995 v9 = rand() % (effectiveActorArmor + 2 * attBonus + 30);
Ritor1
parents:
diff changeset
7996 attPositiveMod = a4 + v9;
Ritor1
parents:
diff changeset
7997 if ( a3 == 2 )
Ritor1
parents:
diff changeset
7998 {
Ritor1
parents:
diff changeset
7999 attNegativeMod = ((effectiveActorArmor + 15) / 2) + effectiveActorArmor + 15;
Ritor1
parents:
diff changeset
8000 }
Ritor1
parents:
diff changeset
8001 else if ( a3 == 3 )
Ritor1
parents:
diff changeset
8002 {
Ritor1
parents:
diff changeset
8003 attNegativeMod = 2 * effectiveActorArmor + 30;
Ritor1
parents:
diff changeset
8004 }
Ritor1
parents:
diff changeset
8005 else
Ritor1
parents:
diff changeset
8006 {
Ritor1
parents:
diff changeset
8007 attNegativeMod = effectiveActorArmor + 15;
Ritor1
parents:
diff changeset
8008 }
Ritor1
parents:
diff changeset
8009 return (attPositiveMod > attNegativeMod);
Ritor1
parents:
diff changeset
8010 }
Ritor1
parents:
diff changeset
8011
Ritor1
parents:
diff changeset
8012
Ritor1
parents:
diff changeset
8013 //----- (0042ECB5) --------------------------------------------------------
Ritor1
parents:
diff changeset
8014 void Player::_42ECB5_PlayerAttacksActor()
Ritor1
parents:
diff changeset
8015 {
Ritor1
parents:
diff changeset
8016 // char *v5; // eax@8
Ritor1
parents:
diff changeset
8017 // unsigned int v9; // ecx@21
Ritor1
parents:
diff changeset
8018 // char *v11; // eax@26
Ritor1
parents:
diff changeset
8019 // unsigned int v12; // eax@47
Ritor1
parents:
diff changeset
8020 // SoundID v24; // [sp-4h] [bp-40h]@58
Ritor1
parents:
diff changeset
8021
Ritor1
parents:
diff changeset
8022 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
Ritor1
parents:
diff changeset
8023 Player* player = &pParty->pPlayers[uActiveCharacter - 1];
Ritor1
parents:
diff changeset
8024 if (!player->CanAct())
Ritor1
parents:
diff changeset
8025 return;
Ritor1
parents:
diff changeset
8026
Ritor1
parents:
diff changeset
8027 CastSpellInfoHelpers::_427D48();
Ritor1
parents:
diff changeset
8028 //v3 = 0;
Ritor1
parents:
diff changeset
8029 if (pParty->Invisible())
Ritor1
parents:
diff changeset
8030 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
Ritor1
parents:
diff changeset
8031
Ritor1
parents:
diff changeset
8032 //v31 = player->pEquipment.uBow;
Ritor1
parents:
diff changeset
8033 int bow_idx = player->pEquipment.uBow;
Ritor1
parents:
diff changeset
8034 if (bow_idx && player->pInventoryItemList[bow_idx - 1].IsBroken())
Ritor1
parents:
diff changeset
8035 bow_idx = 0;
Ritor1
parents:
diff changeset
8036
Ritor1
parents:
diff changeset
8037 //v32 = 0;
Ritor1
parents:
diff changeset
8038 int wand_item_id = 0;
Ritor1
parents:
diff changeset
8039 //v33 = 0;
Ritor1
parents:
diff changeset
8040 //v4 = v1->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8041 int laser_weapon_item_id = 0;
Ritor1
parents:
diff changeset
8042
Ritor1
parents:
diff changeset
8043 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8044 if (main_hand_idx)
Ritor1
parents:
diff changeset
8045 {
Ritor1
parents:
diff changeset
8046 ItemGen* item = &player->pInventoryItemList[main_hand_idx - 1];
Ritor1
parents:
diff changeset
8047 //v5 = (char *)v1 + 36 * v4;
Ritor1
parents:
diff changeset
8048 if (!item->IsBroken())
Ritor1
parents:
diff changeset
8049 {
Ritor1
parents:
diff changeset
8050 //v28b = &v1->pInventoryItems[v4].uItemID;
Ritor1
parents:
diff changeset
8051 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8052 if (item->GetItemEquipType() == EQUIP_WAND)
Ritor1
parents:
diff changeset
8053 {
Ritor1
parents:
diff changeset
8054 if (item->uNumCharges <= 0)
Ritor1
parents:
diff changeset
8055 player->pEquipment.uMainHand = 0; // wand discharged - unequip
Ritor1
parents:
diff changeset
8056 else
Ritor1
parents:
diff changeset
8057 wand_item_id = item->uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8058 }
Ritor1
parents:
diff changeset
8059 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
Ritor1
parents:
diff changeset
8060 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
Ritor1
parents:
diff changeset
8061 }
Ritor1
parents:
diff changeset
8062 }
Ritor1
parents:
diff changeset
8063
Ritor1
parents:
diff changeset
8064 //v30 = 0;
Ritor1
parents:
diff changeset
8065 //v29 = 0;
Ritor1
parents:
diff changeset
8066 //v28 = 0;
Ritor1
parents:
diff changeset
8067 //v7 = pMouse->uPointingObjectID;
Ritor1
parents:
diff changeset
8068
Ritor1
parents:
diff changeset
8069 int target_pid = pMouse->uPointingObjectID;
Ritor1
parents:
diff changeset
8070 int target_type = PID_TYPE(target_pid),
Ritor1
parents:
diff changeset
8071 target_id = PID_ID(target_pid);
Ritor1
parents:
diff changeset
8072 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
Ritor1
parents:
diff changeset
8073 {
Ritor1
parents:
diff changeset
8074 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
Ritor1
parents:
diff changeset
8075 target_type = PID_TYPE(target_pid);
Ritor1
parents:
diff changeset
8076 target_id = PID_ID(target_pid);
Ritor1
parents:
diff changeset
8077 }
Ritor1
parents:
diff changeset
8078
Ritor1
parents:
diff changeset
8079 Actor* actor = &pActors[target_id];
Ritor1
parents:
diff changeset
8080 int actor_distance = 0;
Ritor1
parents:
diff changeset
8081 if (target_type == OBJECT_Actor)
Ritor1
parents:
diff changeset
8082 {
Ritor1
parents:
diff changeset
8083 int distance_x = actor->vPosition.x - pParty->vPosition.x,
Ritor1
parents:
diff changeset
8084 distance_y = actor->vPosition.y - pParty->vPosition.y,
Ritor1
parents:
diff changeset
8085 distance_z = actor->vPosition.z - pParty->vPosition.z;
Ritor1
parents:
diff changeset
8086 actor_distance = integer_sqrt(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - actor->uActorRadius;
Ritor1
parents:
diff changeset
8087 if (actor_distance < 0)
Ritor1
parents:
diff changeset
8088 actor_distance = 0;
Ritor1
parents:
diff changeset
8089 }
Ritor1
parents:
diff changeset
8090
Ritor1
parents:
diff changeset
8091 bool shooting_bow = false,
Ritor1
parents:
diff changeset
8092 shotting_laser = false,
Ritor1
parents:
diff changeset
8093 shooting_wand = false,
Ritor1
parents:
diff changeset
8094 melee_attack = false;
Ritor1
parents:
diff changeset
8095 if (laser_weapon_item_id)
Ritor1
parents:
diff changeset
8096 {
Ritor1
parents:
diff changeset
8097 shotting_laser = true;
Ritor1
parents:
diff changeset
8098 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LASER_PROJECTILE, uActiveCharacter - 1, 0, 0, uActiveCharacter + 8);
Ritor1
parents:
diff changeset
8099 }
Ritor1
parents:
diff changeset
8100 else if (wand_item_id)
Ritor1
parents:
diff changeset
8101 {
Ritor1
parents:
diff changeset
8102 shooting_wand = true;
Ritor1
parents:
diff changeset
8103
Ritor1
parents:
diff changeset
8104 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8105 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
Ritor1
parents:
diff changeset
8106
Ritor1
parents:
diff changeset
8107 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
Ritor1
parents:
diff changeset
8108 player->pEquipment.uMainHand = 0;
Ritor1
parents:
diff changeset
8109 }
Ritor1
parents:
diff changeset
8110 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
Ritor1
parents:
diff changeset
8111 {
Ritor1
parents:
diff changeset
8112 melee_attack = true;
Ritor1
parents:
diff changeset
8113
Ritor1
parents:
diff changeset
8114 Vec3_int_ a3;
Ritor1
parents:
diff changeset
8115 a3.x = actor->vPosition.x - pParty->vPosition.x;
Ritor1
parents:
diff changeset
8116 a3.y = actor->vPosition.y - pParty->vPosition.y;
Ritor1
parents:
diff changeset
8117 a3.z = actor->vPosition.z - pParty->vPosition.z;
Ritor1
parents:
diff changeset
8118 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
Ritor1
parents:
diff changeset
8119
Ritor1
parents:
diff changeset
8120 Actor::DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
Ritor1
parents:
diff changeset
8121 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED))
Ritor1
parents:
diff changeset
8122 _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter);
Ritor1
parents:
diff changeset
8123 }
Ritor1
parents:
diff changeset
8124 else if (bow_idx)
Ritor1
parents:
diff changeset
8125 {
Ritor1
parents:
diff changeset
8126 shooting_bow = true;
Ritor1
parents:
diff changeset
8127 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
Ritor1
parents:
diff changeset
8128 }
Ritor1
parents:
diff changeset
8129 else
Ritor1
parents:
diff changeset
8130 {
Ritor1
parents:
diff changeset
8131 melee_attack = true;
Ritor1
parents:
diff changeset
8132 ; // actor out of range or no actor; no ranged weapon so melee attacking air
Ritor1
parents:
diff changeset
8133 }
Ritor1
parents:
diff changeset
8134
Ritor1
parents:
diff changeset
8135 if (!pParty->bTurnBasedModeOn && melee_attack) // wands, bows & lasers will add recovery while shooting spell effect
Ritor1
parents:
diff changeset
8136 {
Ritor1
parents:
diff changeset
8137 int recovery = player->GetAttackRecoveryTime(false);
Ritor1
parents:
diff changeset
8138 if (recovery < 30 )
Ritor1
parents:
diff changeset
8139 recovery = 30;
Ritor1
parents:
diff changeset
8140 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
Ritor1
parents:
diff changeset
8141 }
Ritor1
parents:
diff changeset
8142
Ritor1
parents:
diff changeset
8143 int v34 = 0;
Ritor1
parents:
diff changeset
8144 if (shooting_wand)
Ritor1
parents:
diff changeset
8145 return;
Ritor1
parents:
diff changeset
8146 else if (shooting_bow)
Ritor1
parents:
diff changeset
8147 {
Ritor1
parents:
diff changeset
8148 v34 = 5;
Ritor1
parents:
diff changeset
8149 player->PlaySound(SPEECH_50, 0);
Ritor1
parents:
diff changeset
8150 }
2556
91c75d202d30 Shooting bow sound & stats word wrap
a.parshin
parents: 2554
diff changeset
8151 else if (shotting_laser)
2498
Ritor1
parents:
diff changeset
8152 v34 = 7;
Ritor1
parents:
diff changeset
8153 else
Ritor1
parents:
diff changeset
8154 {
Ritor1
parents:
diff changeset
8155 int main_hand_idx = player->pEquipment.uMainHand;
Ritor1
parents:
diff changeset
8156 if (player->HasItemEquipped(EQUIP_TWO_HANDED))
Ritor1
parents:
diff changeset
8157 v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType();
Ritor1
parents:
diff changeset
8158 pTurnEngine->ApplyPlayerAction();
Ritor1
parents:
diff changeset
8159 }
Ritor1
parents:
diff changeset
8160
Ritor1
parents:
diff changeset
8161 switch (v34)
Ritor1
parents:
diff changeset
8162 {
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8163 case 0: pAudioPlayer->PlaySound(SOUND_swing_with_blunt_weapon01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8164 case 1: pAudioPlayer->PlaySound(SOUND_swing_with_sword01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8165 case 2: pAudioPlayer->PlaySound(SOUND_swing_with_sword02, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8166 case 3: pAudioPlayer->PlaySound(SOUND_swing_with_axe01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8167 case 4: pAudioPlayer->PlaySound(SOUND_swing_with_axe03, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8168 case 5: pAudioPlayer->PlaySound(SOUND_shoot_bow01, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8169 case 6: pAudioPlayer->PlaySound(SOUND_swing_with_blunt_weapon03, 0, 0, -1, 0, 0, 0, 0); break;
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2506
diff changeset
8170 case 7: pAudioPlayer->PlaySound(SOUND_shoot_blaster01, 0, 0, -1, 0, 0, 0, 0); break;
2498
Ritor1
parents:
diff changeset
8171 }
Ritor1
parents:
diff changeset
8172 }
Ritor1
parents:
diff changeset
8173
Ritor1
parents:
diff changeset
8174
Ritor1
parents:
diff changeset
8175 //----- (0042FA66) --------------------------------------------------------
Ritor1
parents:
diff changeset
8176 void Player::_42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
Ritor1
parents:
diff changeset
8177 {
Ritor1
parents:
diff changeset
8178 unsigned __int16 v9; // ax@5
Ritor1
parents:
diff changeset
8179
Ritor1
parents:
diff changeset
8180 SpriteObject a1a; // [sp+Ch] [bp-74h]@1
Ritor1
parents:
diff changeset
8181 //SpriteObject::SpriteObject(&a1a);
2566
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2556
diff changeset
8182 a1a.uType = SPRITE_600;
30eb6dcac768 big spell fx overhaul
a.parshin
parents: 2556
diff changeset
8183 a1a.containing_item.Reset();
2498
Ritor1
parents:
diff changeset
8184
Ritor1
parents:
diff changeset
8185 a1a.spell_id = SPELL_FIRE_FIREBALL;
Ritor1
parents:
diff changeset
8186 a1a.spell_level = 8;
Ritor1
parents:
diff changeset
8187 a1a.spell_skill = 3;
Ritor1
parents:
diff changeset
8188 v9 = 0;
Ritor1
parents:
diff changeset
8189 for ( uint i = 0; i < pObjectList->uNumObjects; ++i )
Ritor1
parents:
diff changeset
8190 {
Ritor1
parents:
diff changeset
8191 if ( a1a.uType == pObjectList->pObjects[i].uObjectID )
Ritor1
parents:
diff changeset
8192 v9 = i;
Ritor1
parents:
diff changeset
8193 }
Ritor1
parents:
diff changeset
8194 a1a.uObjectDescID = v9;
Ritor1
parents:
diff changeset
8195 a1a.vPosition.x = a1;
Ritor1
parents:
diff changeset
8196 a1a.vPosition.y = a2;
Ritor1
parents:
diff changeset
8197 a1a.vPosition.z = a3;
Ritor1
parents:
diff changeset
8198 a1a.uAttributes = 0;
Ritor1
parents:
diff changeset
8199 a1a.uSectorID = pIndoor->GetSector(a1, a2, a3);
Ritor1
parents:
diff changeset
8200 a1a.uSpriteFrameID = 0;
Ritor1
parents:
diff changeset
8201 a1a.spell_target_pid = 0;
Ritor1
parents:
diff changeset
8202 a1a.field_60_distance_related_prolly_lod = 0;
Ritor1
parents:
diff changeset
8203 a1a.uFacing = 0;
Ritor1
parents:
diff changeset
8204 a1a.uSoundID = 0;
Ritor1
parents:
diff changeset
8205 if ( a6 >= 1 || a6 <= 4 )
Ritor1
parents:
diff changeset
8206 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
Ritor1
parents:
diff changeset
8207 else
Ritor1
parents:
diff changeset
8208 a1a.spell_caster_pid = 0;
Ritor1
parents:
diff changeset
8209
Ritor1
parents:
diff changeset
8210 int id = a1a.Create(0, 0, 0, 0);
Ritor1
parents:
diff changeset
8211 if (id != -1)
Ritor1
parents:
diff changeset
8212 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y),
Ritor1
parents:
diff changeset
8213 SLOWORD(a1a.vPosition.z), 0, 0);
Ritor1
parents:
diff changeset
8214 }
Ritor1
parents:
diff changeset
8215
Ritor1
parents:
diff changeset
8216 //----- (00458244) --------------------------------------------------------
Ritor1
parents:
diff changeset
8217 unsigned int SkillToMastery( unsigned int skill_value )
Ritor1
parents:
diff changeset
8218 {
Ritor1
parents:
diff changeset
8219 switch (skill_value & 0x1C0)
Ritor1
parents:
diff changeset
8220 {
Ritor1
parents:
diff changeset
8221 case 0x100: return 4; // Grandmaster
Ritor1
parents:
diff changeset
8222 case 0x80: return 3; // Master
Ritor1
parents:
diff changeset
8223 case 0x40: return 2; // Expert
Ritor1
parents:
diff changeset
8224 case 0x00: return 1; // Normal
Ritor1
parents:
diff changeset
8225 }
Ritor1
parents:
diff changeset
8226 assert(false);
Ritor1
parents:
diff changeset
8227 return 0;
Ritor1
parents:
diff changeset
8228 }