Basic Burst multi debuff support
This commit is contained in:
1 parent
665144e693
commit
7d5cfd8d0e
1 file changed
+14
-2
@@ -18,6 +18,10 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
// Projectile.ai[0] is the size of the circular hitbox.
|
||||
// Projectile.ai[1] is the minimum multiplier on pierce damage.
|
||||
// Projectile.ai[2] is the number of hits to reach minimum pierce damage.
|
||||
|
||||
// You can use the local ai variables 0 - 3 to inflict up to two debuffs, if you need more than two debuffs just make your own projectile
|
||||
// 0 and 2 are what debuff is being inflicted
|
||||
// 1 and 3 are the debuff duration
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 10;
|
||||
@@ -52,10 +56,14 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.localAI[0] != 0)
|
||||
if (Projectile.localAI[0] != 0) // Debuff 1
|
||||
{
|
||||
target.AddBuff((int)(Projectile.localAI[0]), (int)(Projectile.localAI[1]));
|
||||
}
|
||||
if (Projectile.localAI[2] != 0) // Debuff 2
|
||||
{
|
||||
target.AddBuff((int)(Projectile.localAI[0]), (int)(Projectile.localAI[3]));
|
||||
}
|
||||
pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback;
|
||||
float minMult = Projectile.ai[1];
|
||||
int hitsToMinMult = (int)Projectile.ai[2];
|
||||
@@ -71,15 +79,19 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[0], targetHitbox);
|
||||
}
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
public override void SendExtraAI(BinaryWriter writer) // Sending extra ai for the debuff infliction
|
||||
{
|
||||
writer.Write(Projectile.localAI[0]);
|
||||
writer.Write(Projectile.localAI[1]);
|
||||
writer.Write(Projectile.localAI[2]);
|
||||
writer.Write(Projectile.localAI[3]);
|
||||
}
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
Projectile.localAI[0] = reader.ReadSingle();
|
||||
Projectile.localAI[1] = reader.ReadSingle();
|
||||
Projectile.localAI[2] = reader.ReadSingle();
|
||||
Projectile.localAI[3] = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user