Make Attack secondary effect a unique_ptr.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -150,7 +150,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||
|
||||
if (attackData->GetCategory() == Library::AttackCategory::Status) {
|
||||
if (attackData->HasSecondaryEffect()) {
|
||||
auto effect = attackData->GetSecondaryEffect();
|
||||
auto& effect = attackData->GetSecondaryEffect();
|
||||
bool hasSecondaryEffect;
|
||||
if (effect->GetChance() == -1) {
|
||||
hasSecondaryEffect = true;
|
||||
@@ -175,7 +175,7 @@ void TurnHandler::HandleAttackForTarget(ExecutingAttack* attack, Creature* targe
|
||||
bool preventSecondary = false;
|
||||
HOOK(PreventSecondaryEffects, targetSource, attack, target, hitIndex, &preventSecondary);
|
||||
if (!preventSecondary) {
|
||||
auto effect = attackData->GetSecondaryEffect();
|
||||
auto& effect = attackData->GetSecondaryEffect();
|
||||
bool hasSecondaryEffect;
|
||||
if (effect->GetChance() == -1) {
|
||||
hasSecondaryEffect = true;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace CreatureLib::Battling {
|
||||
if (battle != nullptr) {
|
||||
if (_attack->GetAttack()->HasSecondaryEffect()) {
|
||||
auto library = battle->GetLibrary();
|
||||
auto effect = _attack->GetAttack()->GetSecondaryEffect();
|
||||
auto& effect = _attack->GetAttack()->GetSecondaryEffect();
|
||||
_attackScript = library->LoadScript(ScriptCategory::Attack, effect->GetEffectName());
|
||||
if (_attackScript != nullptr) {
|
||||
_attackScript->OnInitialize(effect->GetParameters());
|
||||
|
||||
Reference in New Issue
Block a user