DayZ 1.28
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 HandleHitEvent(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
149
151 if ((pInputs.IsAttackButtonDown() && !isFireWeapon) || (pInputs.IsMeleeWeaponAttack() && isFireWeapon) || (pContinueAttack && isFireWeapon))
152 {
153 //Debug.MeleeLog(m_Player, string.Format("HandleFightLogic[1] attackButtonDown=%1, meleeWeaponAttack=%2, pContinueAttack=%3, isFireWeapon=%4", pInputs.IsAttackButtonDown(), pInputs.IsMeleeWeaponAttack(), pContinueAttack, isFireWeapon));
154
157 return false;
158
160 if (itemInHands && !itemInHands.IsMeleeWeapon() && !isFireWeapon)
161 return false;
162
164 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE)
165 {
166 //Debug.MeleeLog(m_Player, "HandleFightLogic[1a]");
168 if (isFireWeapon)
169 {
170 return HandleInitialFirearmMelee(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
171 }
172 else
173 {
175 if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
176 {
177 return HandleInitialMeleeErc(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
178 }
180 else if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
181 {
182 return HandleProneKick(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
183 }
185 else if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT && m_Player.IsSprintFull())
186 {
187 return HandleSprintAttack(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
188 }
189 }
190 }
192 else if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_MELEE2)
193 {
194 m_IsInComboRange = m_Player.GetCommand_Melee2().IsInComboRange();
196 {
197 return HandleComboHit(pCurrentCommandID, pInputs, itemInHands, pMovementState, pContinueAttack);
198 }
199 }
200 }
202 else if (!isFireWeapon && pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE)
203 {
205 if (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
206 {
207 int roll = pInputs.IsMeleeLREvade();
208 if (roll != 0)
209 {
211 if (!m_Player.CanConsumeStamina(EStaminaConsumers.MELEE_EVADE))
212 {
213 return false;
214 }
215
216 float angle;
217 if (roll == 1)
218 {
219 angle = -90; // left
220 }
221 else
222 {
223 angle = 90; // right
224 }
225
226 // start melee evade
227 m_IsEvading = true;
229 hcm.StartMeleeEvadeA(angle);
230 m_Player.DepleteStamina(EStaminaModifiers.MELEE_EVADE);
231
232 //Inflict shock when sidestepping with broken legs
233 if (m_Player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
234 {
236 m_Player.m_ShockHandler.CheckValue(true);
237 }
238 }
239 }
240
242 if (pInputs.IsWeaponRaised() && pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH)
243 {
244 //Debug.MeleeLog(m_Player, "HandleFightLogic[2b]");
245 if (DayZPlayerUtils.PlayerCanChangeStance(m_Player, DayZPlayerConstants.STANCEIDX_RAISEDERECT))
246 {
247 //Debug.MeleeLog(m_Player, "HandleFightLogic[2c]");
248 hcm.ForceStance(DayZPlayerConstants.STANCEIDX_RAISEDERECT);
249
250 return false;
251 }
252 }
253
256 if (!isFireWeapon && (pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT || pMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE))
257 {
258 float angle2;
259
260 if (hcm.GetCurrentInputAngle(angle2) && (angle2 < -130.0 || angle2 > 130))
261 {
262 hcm.SetMeleeBlock(true);
263 SetBlock(true);
264 }
265 else
266 {
267 hcm.SetMeleeBlock(false);
268 SetBlock(false);
269 }
270 }
271 else
272 {
273 hcm.SetMeleeBlock(false);
274 SetBlock(false);
275 }
276 }
277
278 return false;
279 }
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:1154
Определения 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().