Handle marksmen weapon attack sequences

This commit is contained in:
Chris Robinson 2013-07-23 06:13:08 -07:00
parent fecb8c1cc4
commit 4d157cb19a

View file

@ -413,20 +413,24 @@ bool CharacterController::updateNpcState()
if(cls.getCreatureStats(mPtr).getAttackingOrSpell()) if(cls.getCreatureStats(mPtr).getAttackingOrSpell())
{ {
if(mUpperBodyState == UpperCharState_WeapEquiped && mWeaponType != WeapType_Crossbow && if(mUpperBodyState == UpperCharState_WeapEquiped && mWeaponType != WeapType_PickProbe)
mWeaponType != WeapType_BowAndArrow && mWeaponType != WeapType_ThowWeapon &&
mWeaponType != WeapType_PickProbe)
{ {
int attackType = cls.getCreatureStats(mPtr).getAttackType(); if(mWeaponType == WeapType_Crossbow || mWeaponType == WeapType_BowAndArrow ||
if(isWeapon && Settings::Manager::getBool("best attack", "Game")) mWeaponType == WeapType_ThowWeapon)
attackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase); mAttackType = "shoot";
if (attackType == MWMechanics::CreatureStats::AT_Chop)
mAttackType = "chop";
else if (attackType == MWMechanics::CreatureStats::AT_Slash)
mAttackType = "slash";
else else
mAttackType = "thrust"; {
int attackType = cls.getCreatureStats(mPtr).getAttackType();
if(isWeapon && Settings::Manager::getBool("best attack", "Game"))
attackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
if (attackType == MWMechanics::CreatureStats::AT_Chop)
mAttackType = "chop";
else if (attackType == MWMechanics::CreatureStats::AT_Slash)
mAttackType = "slash";
else
mAttackType = "thrust";
}
mAnimation->play(mCurrentWeapon, Priority_Weapon, mAnimation->play(mCurrentWeapon, Priority_Weapon,
MWRender::Animation::Group_UpperBody, false, MWRender::Animation::Group_UpperBody, false,
@ -467,19 +471,31 @@ bool CharacterController::updateNpcState()
else if(mUpperBodyState == UpperCharState_MaxAttackToMinHit) else if(mUpperBodyState == UpperCharState_MaxAttackToMinHit)
{ {
mAnimation->disable(mCurrentWeapon); mAnimation->disable(mCurrentWeapon);
mAnimation->play(mCurrentWeapon, Priority_Weapon, if(mAttackType == "shoot")
MWRender::Animation::Group_UpperBody, false, mAnimation->play(mCurrentWeapon, Priority_Weapon,
weapSpeed, mAttackType+" min hit", mAttackType+" hit", MWRender::Animation::Group_UpperBody, false,
0.0f, 0); weapSpeed, mAttackType+" min hit", mAttackType+" follow start",
0.0f, 0);
else
mAnimation->play(mCurrentWeapon, Priority_Weapon,
MWRender::Animation::Group_UpperBody, false,
weapSpeed, mAttackType+" min hit", mAttackType+" hit",
0.0f, 0);
mUpperBodyState = UpperCharState_MinHitToHit; mUpperBodyState = UpperCharState_MinHitToHit;
} }
else if(mUpperBodyState == UpperCharState_MinHitToHit) else if(mUpperBodyState == UpperCharState_MinHitToHit)
{ {
mAnimation->disable(mCurrentWeapon); mAnimation->disable(mCurrentWeapon);
mAnimation->play(mCurrentWeapon, Priority_Weapon, if(mAttackType == "shoot")
MWRender::Animation::Group_UpperBody, true, mAnimation->play(mCurrentWeapon, Priority_Weapon,
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop", MWRender::Animation::Group_UpperBody, true,
0.0f, 0); weapSpeed, mAttackType+" follow start", mAttackType+" follow stop",
0.0f, 0);
else
mAnimation->play(mCurrentWeapon, Priority_Weapon,
MWRender::Animation::Group_UpperBody, true,
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop",
0.0f, 0);
mUpperBodyState = UpperCharState_FollowStartToFollowStop; mUpperBodyState = UpperCharState_FollowStartToFollowStop;
} }
} }