Created
October 30, 2015 22:12
-
-
Save Liareth/d07199174cdc65b415df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int CLEAR_MODE = 0; | |
const int ACTION_MODE_PARRY = 2; | |
const int ACTION_MODE_POWER_ATTACK = 3; | |
const int ACTION_MODE_IMPROVED_POWER_ATTACK = 4; | |
const int ACTION_MODE_COUNTERSPELL = 5; | |
const int ACTION_MODE_FLURRY_OF_BLOWS = 6; | |
const int ACTION_MODE_RAPID_SHOT = 7; | |
const int ACTION_MODE_EXPERTISE = 8; | |
const int ACTION_MODE_IMPROVED_EXPERTISE = 9; | |
const int ACTION_MODE_DEFENSIVE_CAST = 10; | |
const int ACTION_MODE_DIRTY_FIGHTING = 11; | |
switch (m_stickyMap[creature]) | |
{ | |
// PARRY, COUNTERSPELL, DETECT, STEALTH, or NONE | |
case CLEAR_MODE: | |
case ACTION_MODE_PARRY: | |
case ACTION_MODE_COUNTERSPELL: | |
default: | |
// No need to enforce sticky for these. Just leave. | |
return false; | |
break; | |
// Unarmed or melee only. | |
case ACTION_MODE_POWER_ATTACK: | |
if (requestedMode == 0) | |
{ | |
if (GetWeaponRanged(GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND))) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Unarmed or melee only. | |
case ACTION_MODE_IMPROVED_POWER_ATTACK: | |
if (requestedMode == 0) | |
{ | |
if (GetWeaponRanged(GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND))) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Unarmed or kamas only. | |
case ACTION_MODE_FLURRY_OF_BLOWS: | |
if (requestedMode == 0) | |
{ | |
CNWSItem* leftHandItem = GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_LEFTHAND); | |
CNWSItem* rightHandItem = GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND); | |
const int leftHandItemType = GetBaseItemType(leftHandItem); | |
const int rightHandItemType = GetBaseItemType(rightHandItem); | |
// Left hand is neither unarmed nor a kama. | |
const bool leftHandUnsafe = leftHandItemType != BASE_ITEM_INVALID && | |
leftHandItemType != BASE_ITEM_KAMA; | |
// Right hand is neither unarmed nor a kama. | |
const bool rightHandUnsafe = rightHandItemType != BASE_ITEM_INVALID && | |
rightHandItemType != BASE_ITEM_KAMA; | |
if (leftHandUnsafe || rightHandUnsafe) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Ranged only, excluding crossbows. | |
case ACTION_MODE_RAPID_SHOT: | |
if (requestedMode == 0) | |
{ | |
CNWSItem* rightHandItem = GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND); | |
if (!GetWeaponRanged(rightHandItem) || | |
GetBaseItemType(rightHandItem) == BASE_ITEM_LIGHTCROSSBOW || | |
GetBaseItemType(rightHandItem) == BASE_ITEM_HEAVYCROSSBOW) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Unarmed or melee only. | |
case ACTION_MODE_EXPERTISE: | |
if (requestedMode == 0) | |
{ | |
if (GetWeaponRanged(GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND))) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Unarmed or melee only. | |
case ACTION_MODE_IMPROVED_EXPERTISE: | |
if (requestedMode == 0) | |
{ | |
if (GetWeaponRanged(GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND))) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
// Nothing special here. Defensive casting can be activated with all weapon styles. | |
case ACTION_MODE_DEFENSIVE_CAST: | |
if (requestedMode == 0) | |
{ | |
return true; | |
} | |
break; | |
// Unarmed or melee only. | |
case ACTION_MODE_DIRTY_FIGHTING: | |
if (requestedMode == 0) | |
{ | |
if (GetWeaponRanged(GetItemInSlot(GetInventory(creature), EQUIPMENT_SLOT_RIGHTHAND))) | |
{ | |
m_stickyMap[creature] = 0; | |
return false; | |
} | |
else | |
{ | |
return true; | |
} | |
} | |
break; | |
} | |
return false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment