DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HandleFightLogic()

bool HandleFightLogic ( int pCurrentCommandID,
HumanInputController pInputs,
EntityAI pEntityInHands,
HumanMovementState pMovementState,
out bool pContinueAttack )
protected

Check if we need to damage

Actually pressing a button to start a melee attack

do not perform attacks when blocking

if the item in hands cannot be used as melee weapon

Currently not performing any attacks, so here we start the initial

melee with firearm

first attack in raised erc (light or heavy if modifier is used). Also added support for finishers

kick from raised pne

sprint attack in erc stance

combo hits - when we are already in Melee command and clicking UseButton

evade and blocking logic

evades in raised erc stance while moving

not enough stamina to do evades

stand up when crouching and raised pressed

blocks in raised erc/pro stance (bare hand or with melee weapon only)

См. определение в файле DayZPlayerMeleeFightLogic_LightHeavy.c строка 137

138 {
139 HumanInventoryWithFSM invFSM = HumanInventoryWithFSM.Cast(m_Player.GetHumanInventory());
140 if (invFSM && !invFSM.IsIdle())
141 return false;
142
143 HumanCommandMove hcm = m_Player.GetCommand_Move();
144 InventoryItem itemInHands = InventoryItem.Cast(pEntityInHands);
145 bool isFireWeapon = itemInHands && itemInHands.IsWeapon();
146
148 if (HandleHitEvent(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack))
149 return false;
150
152 if ((pInputs.IsAttackButtonDown() && !isFireWeapon) || (pInputs.IsMeleeWeaponAttack() && isFireWeapon) || (pContinueAttack && isFireWeapon))
153 {
154 //Debug.MeleeLog(m_Player, string.Format("HandleFightLogic[1] attackButtonDown=%1, meleeWeaponAttack=%2, pContinueAttack=%3, isFireWeapon=%4", pInputs.IsAttackButtonDown(), pInputs.IsMeleeWeaponAttack(), pContinueAttack, isFireWeapon));
155
158 return false;
159
161 if (itemInHands && !itemInHands.IsMeleeWeapon() && !isFireWeapon)
162 return false;
163
165 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE)
166 {
167 //Debug.MeleeLog(m_Player, "HandleFightLogic[1a]");
169 if (isFireWeapon)
170 {
171 return HandleInitialFirearmMelee(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
172 }
173 else
174 {
176 if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
177 {
178 return HandleInitialMeleeErc(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
179 }
181 else if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
182 {
183 return HandleProneKick(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
184 }
186 else if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT && m_Player.IsSprintFull())
187 {
188 return HandleSprintAttack(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
189 }
190 }
191 }
193 else if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_MELEE2)
194 {
195 m_IsInComboRange = m_Player.GetCommand_Melee2().IsInComboRange();
197 {
198 return HandleComboHit(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
199 }
200 }
201 }
203 else if (!isFireWeapon && pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE)
204 {
206 if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
207 {
208 int roll = pInputs.IsMeleeLREvade();
209 if (roll != 0)
210 {
212 if (!m_Player.CanConsumeStamina(EStaminaConsumers.MELEE_EVADE))
213 {
214 return false;
215 }
216
217 float angle;
218 if (roll == 1)
219 {
220 angle = -90; // left
221 }
222 else
223 {
224 angle = 90; // right
225 }
226
227 // start melee evade
228 m_IsEvading = true;
230 hcm.StartMeleeEvadeA(angle);
231 m_Player.DepleteStamina(EStaminaModifiers.MELEE_EVADE);
232
233 //Inflict shock when sidestepping with broken legs
234 if (m_Player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
235 {
237 m_Player.m_ShockHandler.CheckValue(true);
238 }
239 }
240 }
241
243 if (pInputs.IsWeaponRaised() && pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH)
244 {
245 //Debug.MeleeLog(m_Player, "HandleFightLogic[2b]");
246 if (DayZPlayerUtils.PlayerCanChangeStance(m_Player, DayZPlayerConstants.STANCEIDX_RAISEDERECT))
247 {
248 //Debug.MeleeLog(m_Player, "HandleFightLogic[2c]");
249 hcm.ForceStance(DayZPlayerConstants.STANCEIDX_RAISEDERECT);
250
251 return false;
252 }
253 }
254
257 if (!isFireWeapon && (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT || pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE))
258 {
259 float angle2;
260
261 if (hcm.GetCurrentInputAngle(angle2) && (angle2 < -130.0 || angle2 > 130))
262 {
263 hcm.SetMeleeBlock(true);
264 SetBlock(true);
265 }
266 else
267 {
268 hcm.SetMeleeBlock(false);
269 SetBlock(false);
270 }
271 }
272 else
273 {
274 hcm.SetMeleeBlock(false);
275 SetBlock(false);
276 }
277 }
278
279 return false;
280 }
bool HandleProneKick(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
kick from raised pne
bool m_IsInComboRange
EFightLogicCooldownCategory
Light / Heavy punches.
bool HandleHitEvent(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
Handle the event that our melee hit something.
enum EFightLogicCooldownCategory EVADE_COOLDOWN
cooldown timers settings
bool m_IsEvading
bool m_IsInBlock
void SetBlock(bool block)
bool HandleInitialFirearmMelee(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
NOTE: Only singular (or first) hits, combo attacks are handled in combo.
bool HandleSprintAttack(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
sprint attack in erc stance
bool HandleComboHit(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
combo hits - when we are already in Melee command and clicking UseButton
void SetCooldown(float time, EFightLogicCooldownCategory cooldownCategory)
bool HandleInitialMeleeErc(int pCurrentCommandID, HumanInputController pInputs, InventoryItem itemInHands, HumanMovementState pMovementState, out bool pContinueAttack)
First attack in raised erc (light or heavy if modifier is used). Also added support for finishers.
void DayZPlayerUtils()
cannot be instantiated
Определения DayZPlayerUtils.c:465
eBrokenLegs
Определения EBrokenLegs.c:2
EStaminaConsumers
Определения EStaminaConsumers.c:2
EStaminaModifiers
Определения EStaminaModifiers.c:2
DayZPlayer m_Player
Определения Hand_Events.c:42
proto native void StartMeleeEvadeA(float pDirAngle)
marks command to continue to combo, pDirAngle specifies angle
proto native void ForceStance(int pStanceIdx)
proto bool GetCurrentInputAngle(out float pAngle)
proto native void SetMeleeBlock(bool pBlock)
this enables/disables block
Определения human.c:434
proto native int IsMeleeLREvade()
returns 0,1,2 = none,left,right
proto native bool IsWeaponRaised()
returns true if weapon is raised
proto native bool IsMeleeWeaponAttack()
return weapon melee attack modifier
proto native bool IsAttackButtonDown()
returns true if 'UAFire' button has just been pressed (== true for 1 tick only). Synced.
HumanInventory... with FSM (synchronous, no anims)
Определения HumanInventoryWithFSM.c:6
int m_iStanceIdx
current command's id
Определения human.c:1141
Определения ItemBase.c:15
static const float BROKEN_LEGS_LIGHT_MELEE_SHOCK
Определения PlayerConstants.c:227
Определения PlayerConstants.c:2
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602

Перекрестные ссылки PlayerConstants::BROKEN_LEGS_LIGHT_MELEE_SHOCK, DayZPlayerUtils(), EVADE_COOLDOWN, HumanCommandMove::ForceStance(), HumanCommandMove::GetCurrentInputAngle(), HandleComboHit(), HandleHitEvent(), HandleInitialFirearmMelee(), HandleInitialMeleeErc(), HandleProneKick(), HandleSprintAttack(), HumanInputController::IsAttackButtonDown(), HumanInventoryWithFSM::IsIdle(), HumanInputController::IsMeleeLREvade(), HumanInputController::IsMeleeWeaponAttack(), HumanInputController::IsWeaponRaised(), m_IsEvading, m_IsInBlock, m_IsInComboRange, HumanMovementState::m_iStanceIdx, m_Player, SetBlock(), SetCooldown(), HumanCommandMove::SetMeleeBlock() и HumanCommandMove::StartMeleeEvadeA().