mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
corrected things connected to determining attack type
This commit is contained in:
parent
87e83a92f8
commit
45b3aa3d93
4 changed files with 31 additions and 55 deletions
|
@ -163,9 +163,7 @@ namespace MWMechanics
|
|||
float rangeMelee;
|
||||
float rangeCloseUp;
|
||||
bool distantCombat = false;
|
||||
int attackType = actor.getClass().getCreatureStats(actor).getAttackType();
|
||||
if (weaptype==WeapType_BowAndArrow || weaptype==WeapType_Crossbow || weaptype==WeapType_ThowWeapon
|
||||
|| attackType==MWMechanics::CreatureStats::AT_Target )
|
||||
if (weaptype==WeapType_BowAndArrow || weaptype==WeapType_Crossbow || weaptype==WeapType_ThowWeapon)
|
||||
{
|
||||
rangeMelee = 1000; // TODO: should depend on archer skill
|
||||
rangeCloseUp = 0; //doesn't needed when attacking from distance
|
||||
|
|
|
@ -644,7 +644,12 @@ bool CharacterController::updateNpcState()
|
|||
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Left Hand", effect->mParticle);
|
||||
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Right Hand", effect->mParticle);
|
||||
|
||||
determineAttackType(effectentry.mRange);
|
||||
switch(effectentry.mRange)
|
||||
{
|
||||
case 0: mAttackType = "self"; break;
|
||||
case 1: mAttackType = "touch"; break;
|
||||
case 2: mAttackType = "target"; break;
|
||||
}
|
||||
|
||||
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||
MWRender::Animation::Group_UpperBody, true,
|
||||
|
@ -698,7 +703,7 @@ bool CharacterController::updateNpcState()
|
|||
mAttackType = "shoot";
|
||||
else
|
||||
{
|
||||
int attackType = stats.getAttackType();
|
||||
int attackType;
|
||||
if(isWeapon && Settings::Manager::getBool("best attack", "Game"))
|
||||
attackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
|
||||
else
|
||||
|
@ -1302,10 +1307,8 @@ void CharacterController::updateVisibility()
|
|||
mAnimation->setAlpha(alpha);
|
||||
}
|
||||
|
||||
void CharacterController::determineAttackType(int spellRange)
|
||||
void CharacterController::determineAttackType()
|
||||
{
|
||||
if(spellRange == -1)
|
||||
{
|
||||
float * move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
||||
|
||||
if (move[0] && !move[1]) //sideway
|
||||
|
@ -1332,27 +1335,6 @@ void CharacterController::determineAttackType(int spellRange)
|
|||
else
|
||||
mCurrentWeapon = "attack1";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(spellRange)
|
||||
{
|
||||
case 0:
|
||||
mAttackType = "self";
|
||||
mPtr.getClass().getCreatureStats(mPtr).setAttackType(MWMechanics::CreatureStats::AT_Self);
|
||||
break;
|
||||
case 1:
|
||||
mAttackType = "touch";
|
||||
mPtr.getClass().getCreatureStats(mPtr).setAttackType(MWMechanics::CreatureStats::AT_Touch);
|
||||
break;
|
||||
case 2:
|
||||
mAttackType = "target";
|
||||
mPtr.getClass().getCreatureStats(mPtr).setAttackType(MWMechanics::CreatureStats::AT_Target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -165,7 +165,7 @@ class CharacterController
|
|||
float mSecondsOfRunning;
|
||||
|
||||
std::string mAttackType; // slash, chop or thrust
|
||||
void determineAttackType(int spellRange = -1);
|
||||
void determineAttackType();
|
||||
|
||||
void refreshCurrentAnims(CharacterState idle, CharacterState movement, bool force=false);
|
||||
|
||||
|
|
|
@ -118,11 +118,7 @@ namespace MWMechanics
|
|||
{
|
||||
AT_Chop,
|
||||
AT_Slash,
|
||||
AT_Thrust,
|
||||
|
||||
AT_Self,
|
||||
AT_Touch,
|
||||
AT_Target,
|
||||
AT_Thrust
|
||||
};
|
||||
void setAttackType(int attackType) { mAttackType = attackType; }
|
||||
int getAttackType() { return mAttackType; }
|
||||
|
|
Loading…
Reference in a new issue