mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/SAI: Allow SMART_ACTION_SUMMON_CREATURE to summon more than 1 creature
Add 6th parameter "count" to SMART_ACTION_SUMMON_CREATURE action to summon more than 1 creature. For backward compatibility, a value of 0 will be treated as 1.
This commit is contained in:
@@ -1266,6 +1266,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
bool personalSpawn = flags.HasFlag(SmartActionSummonCreatureFlags::PersonalSpawn);
|
||||
uint32 spawnsCount = std::max(e.action.summonCreature.count, 1u);
|
||||
|
||||
float x, y, z, o;
|
||||
for (WorldObject* target : targets)
|
||||
@@ -1275,17 +1276,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
y += e.target.y;
|
||||
z += e.target.z;
|
||||
o += e.target.o;
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), personalSpawn))
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(target->ToUnit());
|
||||
for (uint32 counter = 0; counter < spawnsCount; counter++)
|
||||
{
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), personalSpawn))
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(target->ToUnit());
|
||||
}
|
||||
}
|
||||
|
||||
if (e.GetTargetType() != SMART_TARGET_POSITION)
|
||||
break;
|
||||
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), personalSpawn))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
for (uint32 counter = 0; counter < spawnsCount; counter++)
|
||||
{
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), personalSpawn))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SUMMON_GO:
|
||||
|
||||
@@ -710,6 +710,7 @@ struct SmartAction
|
||||
uint32 duration;
|
||||
uint32 attackInvoker;
|
||||
uint32 flags; // SmartActionSummonCreatureFlags
|
||||
uint32 count;
|
||||
} summonCreature;
|
||||
|
||||
struct
|
||||
|
||||
Reference in New Issue
Block a user