More work on scripts.

This commit is contained in:
hondacrx
2023-10-13 20:25:10 -04:00
parent b2ac8035f2
commit 50cda96b45
16 changed files with 1073 additions and 732 deletions
+61 -72
View File
@@ -1,4 +1,4 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
@@ -7,85 +7,74 @@ using Game.Entities;
using Game.Scripting;
using System;
namespace Scripts.Pets
namespace Scripts.Pets.Shaman
{
namespace Shaman
[Script]
class npc_pet_shaman_earth_elemental : ScriptedAI
{
struct SpellIds
{
//npc_pet_shaman_earth_elemental
public const uint AngeredEarth = 36213;
const uint SpellShamanAngeredearth = 36213;
//npc_pet_shaman_fire_elemental
public const uint FireBlast = 57984;
public const uint FireNova = 12470;
public const uint FireShield = 13376;
public npc_pet_shaman_earth_elemental(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
DoCastVictim(SpellShamanAngeredearth);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
}
[Script]
class npc_pet_shaman_earth_elemental : ScriptedAI
public override void UpdateAI(uint diff)
{
public npc_pet_shaman_earth_elemental(Creature creature) : base(creature) { }
if (!UpdateVictim())
return;
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
DoCastVictim(SpellIds.AngeredEarth);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
}
_scheduler.Update(diff);
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
DoMeleeAttackIfReady();
}
}
[Script]
public class npc_pet_shaman_fire_elemental : ScriptedAI
{
public npc_pet_shaman_fire_elemental(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.FireNova);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellIds.FireShield);
task.Repeat(TimeSpan.FromSeconds(2));
});
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
DoCastVictim(SpellIds.FireBlast);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me.HasUnitState(UnitState.Casting))
return;
DoMeleeAttackIfReady();
}
DoMeleeAttackIfReady();
}
}
}
[Script]
class npc_pet_shaman_fire_elemental : ScriptedAI
{
const uint SpellShamanFireblast = 57984;
const uint SpellShamanFirenova = 12470;
const uint SpellShamanFireshield = 13376;
public npc_pet_shaman_fire_elemental(Creature creature) : base(creature) { }
public override void Reset()
{
_scheduler.CancelAll();
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellShamanFirenova);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20), task =>
{
DoCastVictim(SpellShamanFireblast);
task.Repeat(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(20));
});
_scheduler.Schedule(TimeSpan.FromSeconds(0), task =>
{
DoCastVictim(SpellShamanFireshield);
task.Repeat(TimeSpan.FromSeconds(2));
});
}
public override void UpdateAI(uint diff)
{
if (!UpdateVictim())
return;
if (me.HasUnitState(UnitState.Casting))
return;
_scheduler.Update(diff, DoMeleeAttackIfReady);
}
}
}