예제 #1
0
        public override void Update(TerraGuardian tg, GuardianSpecialAttackData data)
        {
            switch (data.Step)
            {
            case 0:
                if (tg.ItemAnimationTime == 0)
                {
                    data.ChangeStep();
                    Frame           = 0;
                    FrameTime       = 0;
                    AwakenedVersion = BaphaBase.IsAwakened(tg);
                }
                break;

            case 1:
            {
                bool Hit = false;
                FrameTime++;
                if (FrameTime >= 6)
                {
                    Frame++;
                    FrameTime = 0;
                    Hit       = Frame == 2;
                    if (Frame >= 6)
                    {
                        data.EndUse();
                        return;
                    }
                }
                if (Hit)
                {
                    Rectangle Rect = new Rectangle(0, 0, (int)(240 * tg.Scale), (int)(240 * tg.Scale));
                    Rect.X = (int)(tg.Position.X - (tg.LookingLeft ? Rect.Width * 0.55f : Rect.Width * 0.45f));
                    Rect.Y = (int)(tg.CenterY - Rect.Height * 0.45f);
                    int Damage = AwakenedVersion ? 50 : 25;
                    if (tg.SelectedItem > -1)
                    {
                        Damage += (int)(tg.Inventory[tg.SelectedItem].damage * ((float)tg.Inventory[tg.SelectedItem].useAnimation / tg.Inventory[tg.SelectedItem].useTime) * (AwakenedVersion ? 2 : 1.5f));
                    }
                    Damage = (int)(Damage * tg.MeleeDamageMultiplier);
                    GuardianSpecialAttackData.AffectedTargets[] targets = AreaDamage(tg, Damage, AwakenedVersion ? 12 : 8, Rect, BlockConsecutiveHits: false);
                    int BuffID = AwakenedVersion ? Terraria.ModLoader.ModContent.BuffType <Buffs.CrimsonConflagration>() : Terraria.ID.BuffID.OnFire;
                    foreach (GuardianSpecialAttackData.AffectedTargets t in targets)
                    {
                        switch (t.Target)
                        {
                        case GuardianSpecialAttackData.AffectedTargets.TargetTypes.Player:
                            Main.player[t.TargetID].AddBuff(BuffID, 5 * 60);
                            break;

                        case GuardianSpecialAttackData.AffectedTargets.TargetTypes.NPC:
                            Main.npc[t.TargetID].AddBuff(BuffID, 5 * 60);
                            Main.npc[t.TargetID].HitEffect(tg.Direction, t.Damage);
                            break;

                        case GuardianSpecialAttackData.AffectedTargets.TargetTypes.TerraGuardian:
                            MainMod.ActiveGuardians[t.TargetID].AddBuff(BuffID, 5 * 60);
                            break;
                        }
                    }
                }
            }
            break;
            }
        }
예제 #2
0
 public override bool CanUse(TerraGuardian tg)
 {
     return(BaphaBase.IsAwakened(tg) == IsAwakenedVersion);
 }