forked from mirror/openmw-tes3mp
[General] Synchronize strike enchantments in combat
This commit is contained in:
parent
76468dc8c6
commit
3f8d94b030
6 changed files with 43 additions and 2 deletions
|
@ -307,6 +307,7 @@ namespace MWClass
|
|||
if (localAttack)
|
||||
{
|
||||
localAttack->success = true;
|
||||
localAttack->usesStrikeEnchantment = false;
|
||||
MechanicsHelper::assignAttackTarget(localAttack, victim);
|
||||
}
|
||||
/*
|
||||
|
@ -373,7 +374,20 @@ namespace MWClass
|
|||
}
|
||||
|
||||
// Apply "On hit" enchanted weapons
|
||||
MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (minor)
|
||||
|
||||
Track whether the strike enchantment is successful for attacks by the
|
||||
LocalPlayer or LocalActors
|
||||
*/
|
||||
bool appliedEnchantment = MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition);
|
||||
|
||||
if (localAttack)
|
||||
localAttack->usesStrikeEnchantment = appliedEnchantment;
|
||||
/*
|
||||
End of tes3mp change (minor)
|
||||
*/
|
||||
}
|
||||
else if (isBipedal(ptr))
|
||||
{
|
||||
|
|
|
@ -634,6 +634,7 @@ namespace MWClass
|
|||
if (localAttack)
|
||||
{
|
||||
localAttack->success = true;
|
||||
localAttack->usesStrikeEnchantment = false;
|
||||
MechanicsHelper::assignAttackTarget(localAttack, victim);
|
||||
}
|
||||
/*
|
||||
|
@ -706,7 +707,20 @@ namespace MWClass
|
|||
damage *= store.find("fCombatKODamageMult")->getFloat();
|
||||
|
||||
// Apply "On hit" enchanted weapons
|
||||
MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition);
|
||||
|
||||
/*
|
||||
Start of tes3mp change (minor)
|
||||
|
||||
Track whether the strike enchantment is successful for attacks by the
|
||||
LocalPlayer or LocalActors
|
||||
*/
|
||||
bool appliedEnchantment = MWMechanics::applyOnStrikeEnchantment(ptr, victim, weapon, hitPosition);
|
||||
|
||||
if (localAttack)
|
||||
localAttack->usesStrikeEnchantment = appliedEnchantment;
|
||||
/*
|
||||
End of tes3mp change (minor)
|
||||
*/
|
||||
|
||||
MWMechanics::applyElementalShields(ptr, victim);
|
||||
|
||||
|
|
|
@ -195,8 +195,17 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MWMechanics::blockMeleeAttack(attacker, victim, weapon, attack.damage, 1);
|
||||
|
||||
if (attack.usesStrikeEnchantment)
|
||||
{
|
||||
MWMechanics::CastSpell cast(attacker, victim, false);
|
||||
cast.mHitPosition = osg::Vec3f();
|
||||
cast.cast(weapon, false);
|
||||
}
|
||||
}
|
||||
|
||||
victim.getClass().onHit(victim, attack.damage, healthdmg, weapon, attacker, osg::Vec3f(),
|
||||
attack.success);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace mwmp
|
|||
bool pressed;
|
||||
bool instant;
|
||||
bool knockdown;
|
||||
bool usesStrikeEnchantment;
|
||||
|
||||
bool shouldSend;
|
||||
};
|
||||
|
|
|
@ -25,4 +25,5 @@ void PacketActorAttack::Actor(BaseActor &actor, bool send)
|
|||
RW(actor.attack.block, send);
|
||||
|
||||
RW(actor.attack.instant, send);
|
||||
RW(actor.attack.usesStrikeEnchantment, send);
|
||||
}
|
||||
|
|
|
@ -29,4 +29,6 @@ void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send)
|
|||
RW(player->attack.pressed, send);
|
||||
RW(player->attack.knockdown, send);
|
||||
RW(player->attack.block, send);
|
||||
|
||||
RW(player->attack.usesStrikeEnchantment, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue