mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
add single target damage to actions
This commit is contained in:
parent
f07a743511
commit
0c3cdf959e
2 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
|
||||
class ActionHeavyShot97 :
|
||||
public Sapphire::ScriptAPI::ActionScript
|
||||
|
@ -20,7 +21,7 @@ public:
|
|||
void onCharaHit( Sapphire::Entity::Chara& sourceActor, Sapphire::Entity::Chara& hitActor,
|
||||
Sapphire::Action::Action& currentAction ) override
|
||||
{
|
||||
|
||||
currentAction.damageTarget( 100, hitActor );
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -242,7 +242,9 @@ void Sapphire::Action::Action::onFinish()
|
|||
|
||||
if( !hasResidentTarget() )
|
||||
{
|
||||
assert( m_pTarget );
|
||||
// todo: calculate final hit targets and call onCharaHit in action script
|
||||
pScriptMgr->onCharaHit( *m_pSource, *m_pTarget, *this );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -286,6 +288,9 @@ void Sapphire::Action::Action::damageTarget( uint32_t amount, Entity::Chara& cha
|
|||
// todo: aspected damage?
|
||||
chara.takeDamage( amount );
|
||||
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
player->sendDebug( "hit actorId#{0} for damage: {1}", chara.getId(), amount );
|
||||
|
||||
m_effects[ EffectPacketIdentity::DamageEffect ].m_entries.emplace_back( entry );
|
||||
|
||||
// todo: make sure that we don't add the same actor more than once
|
||||
|
@ -313,6 +318,9 @@ void Sapphire::Action::Action::healTarget( uint32_t amount, Entity::Chara& chara
|
|||
|
||||
chara.heal( amount );
|
||||
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
player->sendDebug( "hit actorId#{0} for heal: {1}", chara.getId(), amount );
|
||||
|
||||
m_effects[ EffectPacketIdentity::HealingEffect ].m_entries.emplace_back( entry );
|
||||
|
||||
// todo: make sure that we don't add the same actor more than once
|
||||
|
|
Loading…
Add table
Reference in a new issue