Core/SAI: Allow SMART_ACTION_SUMMON_CREATURE to summon more than 1 creature
Port From (https://github.com/TrinityCore/TrinityCore/commit/40416d62f354c2a49f6acf9fac094401e25d3db8)
This commit is contained in:
@@ -2774,6 +2774,7 @@ namespace Game.AI
|
|||||||
public uint storageID;
|
public uint storageID;
|
||||||
public uint attackInvoker;
|
public uint attackInvoker;
|
||||||
public uint flags; // SmartActionSummonCreatureFlags
|
public uint flags; // SmartActionSummonCreatureFlags
|
||||||
|
public uint count;
|
||||||
}
|
}
|
||||||
public struct ThreatPCT
|
public struct ThreatPCT
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1200,6 +1200,7 @@ namespace Game.AI
|
|||||||
ObjectGuid privateObjectOwner = ObjectGuid.Empty;
|
ObjectGuid privateObjectOwner = ObjectGuid.Empty;
|
||||||
if (flags.HasAnyFlag(SmartActionSummonCreatureFlags.PersonalSpawn))
|
if (flags.HasAnyFlag(SmartActionSummonCreatureFlags.PersonalSpawn))
|
||||||
privateObjectOwner = summoner.IsPrivateObject() ? summoner.GetPrivateObjectOwner() : summoner.GetGUID();
|
privateObjectOwner = summoner.IsPrivateObject() ? summoner.GetPrivateObjectOwner() : summoner.GetGUID();
|
||||||
|
uint spawnsCount = Math.Max(e.Action.summonCreature.count, 1u);
|
||||||
|
|
||||||
float x, y, z, o;
|
float x, y, z, o;
|
||||||
foreach (var target in targets)
|
foreach (var target in targets)
|
||||||
@@ -1209,19 +1210,25 @@ namespace Game.AI
|
|||||||
y += e.Target.y;
|
y += e.Target.y;
|
||||||
z += e.Target.z;
|
z += e.Target.z;
|
||||||
o += e.Target.o;
|
o += e.Target.o;
|
||||||
Creature summon = summoner.SummonCreature(e.Action.summonCreature.creature, x, y, z, o, (TempSummonType)e.Action.summonCreature.type, TimeSpan.FromMilliseconds(e.Action.summonCreature.duration), privateObjectOwner);
|
for (uint counter = 0; counter < spawnsCount; counter++)
|
||||||
if (summon != null)
|
{
|
||||||
if (e.Action.summonCreature.attackInvoker != 0)
|
Creature summon = summoner.SummonCreature(e.Action.summonCreature.creature, x, y, z, o, (TempSummonType)e.Action.summonCreature.type, TimeSpan.FromMilliseconds(e.Action.summonCreature.duration), privateObjectOwner);
|
||||||
summon.GetAI().AttackStart(target.ToUnit());
|
if (summon != null)
|
||||||
|
if (e.Action.summonCreature.attackInvoker != 0)
|
||||||
|
summon.GetAI().AttackStart(target.ToUnit());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.GetTargetType() != SmartTargets.Position)
|
if (e.GetTargetType() != SmartTargets.Position)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Creature summon1 = summoner.SummonCreature(e.Action.summonCreature.creature, e.Target.x, e.Target.y, e.Target.z, e.Target.o, (TempSummonType)e.Action.summonCreature.type, TimeSpan.FromMilliseconds(e.Action.summonCreature.duration), privateObjectOwner);
|
for (uint counter = 0; counter < spawnsCount; counter++)
|
||||||
if (summon1 != null)
|
{
|
||||||
if (unit != null && e.Action.summonCreature.attackInvoker != 0)
|
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, TimeSpan.FromMilliseconds(e.Action.summonCreature.duration), privateObjectOwner);
|
||||||
summon1.GetAI().AttackStart(unit);
|
if (summon != null)
|
||||||
|
if (unit != null && e.Action.summonCreature.attackInvoker != 0)
|
||||||
|
summon.GetAI().AttackStart(unit);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SmartActions.SummonGo:
|
case SmartActions.SummonGo:
|
||||||
|
|||||||
Reference in New Issue
Block a user