public override bool WhenTriggerActivates(TerraGuardian guardian, TriggerTypes trigger, TriggerTarget Sender, int Value, int Value2 = 0, float Value3 = 0, float Value4 = 0, float Value5 = 0) { switch (trigger) { case TriggerTypes.Downed: { if (Sender.TargetType == TriggerTarget.TargetTypes.TerraGuardian) { TerraGuardian tg = MainMod.ActiveGuardians[Sender.TargetID]; AlexanderData data = (AlexanderData)guardian.Data; if (!guardian.DoAction.InUse && !tg.MyID.IsSameID(guardian) && tg.Base.IsTerraGuardian && !data.WasGuardianIdentified(tg)) { if (guardian.StartNewGuardianAction(new Companions.Alexander.SleuthAction(tg), 0)) { return(true); } } } } break; case TriggerTypes.Spotted: { if (Sender.TargetType == TriggerTarget.TargetTypes.TerraGuardian) { TerraGuardian tg = MainMod.ActiveGuardians[Sender.TargetID]; AlexanderData data = (AlexanderData)guardian.Data; if (!guardian.DoAction.InUse && !tg.MyID.IsSameID(guardian) && tg.Base.IsTerraGuardian && tg.IsSleeping && !data.WasGuardianIdentified(tg)) { if (guardian.StartNewGuardianAction(new Companions.Alexander.SleuthAction(tg), 0)) { return(true); } } } } break; } return(base.WhenTriggerActivates(guardian, trigger, Sender, Value, Value2, Value3, Value4, Value5)); }
public const int PullMaxTime = 45; //Like his miniboss version public override void Update(TerraGuardian Me) { if (Me.UsingFurniture) { Me.LeaveFurniture(true); } if (Time >= PullMaxTime) { if (Time == PullMaxTime) { if (TargetIsPlayer) { PullStartPosition = TargetPlayer.Center; if (TargetPlayer.GetModPlayer <PlayerMod>().BeingCarriedByGuardian) { InUse = false; return; } } else { PullStartPosition = TargetGuardian.CenterPosition; if (TargetGuardian.BeingCarriedByGuardian) { InUse = false; return; } } } if (TargetIsPlayer) { Player player = TargetPlayer; Vector2 MoveDirection = Me.CenterPosition - player.Center; MoveDirection.Normalize(); Me.LookingLeft = player.Center.X < Me.Position.X; player.velocity = Vector2.Zero; player.position += MoveDirection * 8f; player.fallStart = (int)player.position.Y / 16; player.immuneTime = 5; player.immuneNoBlink = true; if (player.getRect().Intersects(Me.HitBox)) { player.velocity = Vector2.Zero; InUse = false; Me.StartNewGuardianAction(new Actions.CarryDownedAlly(player)); return; } } else { TerraGuardian guardian = TargetGuardian; Vector2 MoveDirection = Me.CenterPosition - guardian.CenterPosition; MoveDirection.Normalize(); Me.LookingLeft = guardian.Position.X < Me.Position.X; guardian.Velocity = Vector2.Zero; guardian.Position += MoveDirection * 8f; guardian.SetFallStart(); guardian.ImmuneTime = 5; guardian.ImmuneNoBlink = true; if (guardian.HitBox.Intersects(Me.HitBox)) { guardian.Velocity = Vector2.Zero; InUse = false; Me.StartNewGuardianAction(new Actions.CarryDownedAlly(guardian)); return; } } } else { if (Time == 30) { switch (Main.rand.Next(5)) { case 0: Me.SaySomething("*Better you stay close to me.*"); break; case 1: Me.SaySomething("*Let's avoid another death.*"); break; case 2: Me.SaySomething("*Come here.*"); break; case 3: Me.SaySomething("*Get over here.*"); break; case 4: Me.SaySomething("*No, you wont.*"); break; } } } }
public override void GuardianUpdateScript(TerraGuardian guardian) { CilleData data = (CilleData)guardian.Data; if (data.InBeastState) { if (guardian.KnockedOut) { data.InBeastState = false; } else if (!TriggerBeastState(guardian)) { data.InBeastState = false; if (!guardian.KnockedOut && !guardian.Downed) { string Message = ""; switch (Main.rand.Next(3)) { default: Message = "*Huh? It's over... I hope I didn't hurt anyone.*"; break; case 1: Message = "*What happened? Did someone got hurt?*"; break; case 2: Message = "*I'm so glad it's over. I didn't hurt anyone, right?*"; break; } guardian.SaySomethingCanSchedule(Message, false, Main.rand.Next(30, 180)); } /*if (!guardian.DoAction.InUse) * { * data.InBeastState = false; * }*/ } else { if (guardian.OwnerPos > -1 && !guardian.IsPlayerBuddy(Main.player[guardian.OwnerPos])) { if (!NpcMod.HasGuardianNPC(guardian.ID, guardian.ModID)) { WorldMod.GuardianTownNPC.Add(guardian); } Main.player[guardian.OwnerPos].GetModPlayer <PlayerMod>().DismissGuardian(guardian.ID, guardian.ModID); } } } else { if (TriggerBeastState(guardian)) { if (!guardian.DoAction.InUse) { guardian.StartNewGuardianAction(new Companions.Creatures.Cille.BeastStateAction(), BeastStateID); } } } }