mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 11:23:50 +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 rangeMelee;
|
||||||
float rangeCloseUp;
|
float rangeCloseUp;
|
||||||
bool distantCombat = false;
|
bool distantCombat = false;
|
||||||
int attackType = actor.getClass().getCreatureStats(actor).getAttackType();
|
if (weaptype==WeapType_BowAndArrow || weaptype==WeapType_Crossbow || weaptype==WeapType_ThowWeapon)
|
||||||
if (weaptype==WeapType_BowAndArrow || weaptype==WeapType_Crossbow || weaptype==WeapType_ThowWeapon
|
|
||||||
|| attackType==MWMechanics::CreatureStats::AT_Target )
|
|
||||||
{
|
{
|
||||||
rangeMelee = 1000; // TODO: should depend on archer skill
|
rangeMelee = 1000; // TODO: should depend on archer skill
|
||||||
rangeCloseUp = 0; //doesn't needed when attacking from distance
|
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, "Left Hand", effect->mParticle);
|
||||||
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Right 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,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, true,
|
MWRender::Animation::Group_UpperBody, true,
|
||||||
|
@ -698,7 +703,7 @@ bool CharacterController::updateNpcState()
|
||||||
mAttackType = "shoot";
|
mAttackType = "shoot";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int attackType = stats.getAttackType();
|
int attackType;
|
||||||
if(isWeapon && Settings::Manager::getBool("best attack", "Game"))
|
if(isWeapon && Settings::Manager::getBool("best attack", "Game"))
|
||||||
attackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
|
attackType = getBestAttack(weapon->get<ESM::Weapon>()->mBase);
|
||||||
else
|
else
|
||||||
|
@ -1302,9 +1307,7 @@ void CharacterController::updateVisibility()
|
||||||
mAnimation->setAlpha(alpha);
|
mAnimation->setAlpha(alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::determineAttackType(int spellRange)
|
void CharacterController::determineAttackType()
|
||||||
{
|
|
||||||
if(spellRange == -1)
|
|
||||||
{
|
{
|
||||||
float * move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
float * move = mPtr.getClass().getMovementSettings(mPtr).mPosition;
|
||||||
|
|
||||||
|
@ -1332,27 +1335,6 @@ void CharacterController::determineAttackType(int spellRange)
|
||||||
else
|
else
|
||||||
mCurrentWeapon = "attack1";
|
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;
|
float mSecondsOfRunning;
|
||||||
|
|
||||||
std::string mAttackType; // slash, chop or thrust
|
std::string mAttackType; // slash, chop or thrust
|
||||||
void determineAttackType(int spellRange = -1);
|
void determineAttackType();
|
||||||
|
|
||||||
void refreshCurrentAnims(CharacterState idle, CharacterState movement, bool force=false);
|
void refreshCurrentAnims(CharacterState idle, CharacterState movement, bool force=false);
|
||||||
|
|
||||||
|
|
|
@ -118,11 +118,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
AT_Chop,
|
AT_Chop,
|
||||||
AT_Slash,
|
AT_Slash,
|
||||||
AT_Thrust,
|
AT_Thrust
|
||||||
|
|
||||||
AT_Self,
|
|
||||||
AT_Touch,
|
|
||||||
AT_Target,
|
|
||||||
};
|
};
|
||||||
void setAttackType(int attackType) { mAttackType = attackType; }
|
void setAttackType(int attackType) { mAttackType = attackType; }
|
||||||
int getAttackType() { return mAttackType; }
|
int getAttackType() { return mAttackType; }
|
||||||
|
|
Loading…
Reference in a new issue