private void SetDisplayColor(Body body, Color color) { foreach (var sprite in body.EnumerateAll().OfType <Tinter>()) { sprite.VertexColorTint = color; } }
public override Feasibility IsFeasible(Creature agent) { if (EntityToKill == null || EntityToKill.IsDead) { return(Feasibility.Infeasible); } else { var ai = EntityToKill.EnumerateAll().OfType <Creature>().FirstOrDefault(); switch (Mode) { case KillType.Attack: if (!agent.Stats.IsTaskAllowed(Task.TaskCategory.Attack)) { return(Feasibility.Infeasible); } return(agent.Faction.Designations.IsDesignation(EntityToKill, DesignationType.Attack) ? Feasibility.Feasible : Feasibility.Infeasible); case KillType.Chop: if (!agent.Stats.IsTaskAllowed(Task.TaskCategory.Chop)) { return(Feasibility.Infeasible); } return(agent.Faction.Designations.IsDesignation(EntityToKill, DesignationType.Chop) ? Feasibility.Feasible : Feasibility.Infeasible); case KillType.Auto: return(Feasibility.Feasible); } var target = new VoxelHandle(agent.World.ChunkManager.ChunkData, GlobalVoxelCoordinate.FromVector3(EntityToKill.Position)); // Todo: Find out if it is calculating the path twice to make PathExists work. if (!target.IsValid) { return(Feasibility.Infeasible); } if (ai == null) { return(Feasibility.Infeasible); } Relationship relation = agent.World.Diplomacy.GetPolitics(ai.Faction, agent.Faction).GetCurrentRelationship(); return((relation == Relationship.Hateful || relation == Relationship.Indifferent) ? Feasibility.Feasible : Feasibility.Infeasible); } }
public bool CanAttack(Body other) { var creature = other.EnumerateAll().OfType <Creature>().FirstOrDefault(); if (creature == null) { return(false); } if (Player.World.Diplomacy.GetPolitics(creature.Faction, Player.Faction).GetCurrentRelationship() == Relationship.Loving) { return(false); } return(true); }
public override Feasibility IsFeasible(Creature agent) { if (agent == null || agent.IsDead || EntityToKill == null || EntityToKill.IsDead) { return(Feasibility.Infeasible); } else { var ai = EntityToKill.EnumerateAll().OfType <Creature>().FirstOrDefault(); if (Mode == KillType.Attack && !agent.Stats.IsTaskAllowed(TaskCategory.Attack)) { return(Feasibility.Infeasible); } return(Feasibility.Feasible); } }
bool IsDwarf(Body body) { if (body == null) { return(false); } var dwarves = body.EnumerateAll().OfType <Creature>().ToList(); if (dwarves.Count <= 0) { return(false); } Creature dwarf = dwarves[0]; return(dwarf.Faction == Player.Faction); }
bool IsNotSelectedDwarf(Body body) { if (body == null) { return(true); } var dwarves = body.EnumerateAll().OfType <Creature>().ToList(); if (dwarves.Count <= 0) { return(false); } Creature dwarf = dwarves[0]; return(dwarf.Faction == Player.Faction && !Player.SelectedMinions.Contains(dwarf.AI)); }