public override void Attributes(TerraGuardian g) { AlexanderData data = (AlexanderData)g.Data; foreach (GuardianID id in data.IdentifiedGuardians) { ApplySleuthGuardianStatusBonus(g, id); } }
public static bool HasAlexanderSleuthedGuardian(Player player, int GuardianID, string ModID = "") { if (ModID == "") { ModID = MainMod.mod.Name; } if (PlayerMod.PlayerHasGuardian(player, Alexander)) { AlexanderData data = (AlexanderData)PlayerMod.GetPlayerGuardian(player, Alexander); foreach (GuardianID id in data.IdentifiedGuardians) { if (id.IsSameID(GuardianID, ModID)) { return(true); } } } return(false); }
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)); }