public DeliverIngredientAction(Ingredient ingredient) { _ingredient = ingredient; Preconditions.Add("isCarrying", _ingredient); Effects.Add(_ingredient + "Delivered", true); Effects.Add("isCarrying", Ingredient.None); }
public PickUpItem(ItemType item) { Item = item; Preconditions.Add(new Tuple <string, object>("HasItem", item), false); Effects.Add(new Tuple <string, object>("HasItem", item), true); Cost = 1; }
public TakeANapAction() { Preconditions.Add("isNear", "Home"); Preconditions.Add("isTired", true); Effects.Add("isTired", false); }
public ChopWood(GOAPAgent agent, Game game, Movement movement) : base(agent, game, movement) { Preconditions.Add(Effect.HAS_THING, TypeOfThing.Axe); Effects.Add(Effect.HAS_THING, TypeOfThing.Wood); _inventory = agent.GetComponent <Inventory>(); }
public Eat(int itemLayer) { ActionLayer = itemLayer; if (ActionLayer == 7) { Preconditions.Add(GameState.State.itemBerry); coreCost = -200;//gotta eat! so "cost" is lowest. and berry is best thing to eat so eat that } if (ActionLayer == 9) { Preconditions.Add(GameState.State.itemFungus); coreCost = -50; } if (ActionLayer == 10) { Preconditions.Add(GameState.State.itemBerryPoop); coreCost = 30;//eating poop is pretty bad so try not to do it but if you got no other choice... } if (ActionLayer == 16) { Preconditions.Add(GameState.State.itemFungusPoop); coreCost = 30;//eating poop is pretty bad so try not to do it but if you got no other choice... } //eating allows ALL goals. MUST STAY NOURISHED!!!! Effects.Add(GameState.State.goalEat); // Effects.Add(GameState.State.goalFollowPlayer); // Effects.Add(GameState.State.goalGatherFood); // Effects.Add(GameState.State.goalGatherShrooms); // Effects.Add(GameState.State.goalHelpOthers); // Effects.Add(GameState.State.goalAttackEnemies); // Effects.Add(GameState.State.goalAttackCow); Effects.Add(GameState.State.itemNone); }
public EatPieAction() { Preconditions.Add("hasPie", true); Preconditions.Add("isHungry", true); Effects.Add("isHungry", false); Effects.Add("hasPie", false); }
public void AddPrecondition(Precondition precondition) { if (precondition == null) { throw new ArgumentException("Precondition should not be null."); } Preconditions.Add(precondition); }
public EatFood(Food food) { Food = food; Preconditions.Add(new Tuple <string, object>("HasItem", Food.ItemType), true); Effects.Add(new Tuple <string, object>("HasItem", Food.ItemType), false); Effects.Add(new Tuple <string, object>("EatItem", Food.ItemType), true); Cost = 5; }
public Follow() { Init(); ActionLayer = 13; eventRange = Random.Range(5, 8); //minimum distance required to satisfy following state Preconditions.Add(GameState.State.playerAlive); Effects.Add(GameState.State.goalFollowPlayer); }
public ChopWoodAction() { Preconditions.Add("isTired", false); Preconditions.Add("hasAxe", true); Preconditions.Add("isNear", "Tree"); Effects.Add("hasWood", true); Effects.Add("isTired", true); }
/// <summary> /// Commits all changes. Waits for the operation to complete. /// </summary> protected override void DoSaveChanges() { if (_optimisticLockingEnabled) { // get subject entity and see if there is a version triple var subjects = AddTriples.Select(x => x.Subject) .Distinct() .Union(DeletePatterns.Select(x => x.Subject).Distinct()) .Except(new[] { Constants.WildcardUri }) .ToList(); foreach (var subject in subjects) { var entity = LookupDataObject(subject); if (entity == null) { throw new BrightstarClientException("No Entity Found for Subject " + subject); } var version = entity.GetPropertyValue(Constants.VersionPredicateUri); if (version == null) { // no existing version information so assume this is the first entity.SetProperty(Constants.VersionPredicateUri, 1); } else { var intVersion = Convert.ToInt32(version); // inc version intVersion++; entity.SetProperty(Constants.VersionPredicateUri, intVersion); Preconditions.Add(new Triple { Subject = subject, Predicate = Constants.VersionPredicateUri, Object = version.ToString(), IsLiteral = true, DataType = RdfDatatypes.Integer, LangCode = null, Graph = VersionGraphUri }); } } } try { Client.ApplyTransaction(Preconditions, DeletePatterns, AddTriples, UpdateGraphUri); } catch (TransactionPreconditionsFailedException) { Preconditions.Clear(); throw; } // reset changes ResetTransactionData(); }
public SellAction(string product) { _product = product; Preconditions.Add("isNear", "Shop"); Preconditions.Add("has" + _product, true); Effects.Add("hasGold", true); Effects.Add("has" + _product, false); }
public override void OnStart(AIBrain brain) { m_Priority = 8; m_IsInterruptable = true; m_RepeatType = ET.ActionRepeatType.Single; Preconditions.Add(HelpStrings.AI.NEXT_TO_FOOD, true); Effects.Add(HelpStrings.AI.IS_HUNGRY, false); }
public Idle(GOAPAgent agent, Game game, Movement movement) : base(agent, game) { _movement = movement; Goal = GOAPGoal.Goal.IS_IDLING; Preconditions.Add(Effect.HAS_THING, TypeOfThing.None); //Effects.Add(GOAPAction.Effect.IS_WORKING, true); }
public override void OnStart(AIBrain brain) { m_Priority = 12; m_IsInterruptable = true; m_RepeatType = ET.ActionRepeatType.Single; Preconditions.Add(HelpStrings.AI.IS_PLAYER_IN_SIGHT, true); Effects.Add(HelpStrings.AI.IS_PLAYER_IN_SIGHT, false); }
public DrinkAlcoholAction() { Preconditions.Add("hasAlcohol", true); Preconditions.Add("isSober", true); Preconditions.Add("isDrunk", false); Effects.Add("hasAlcohol", false); Effects.Add("isSober", false); Effects.Add("isDrunk", true); }
public override void OnStart(AIBrain brain) { m_Priority = 10; m_RepeatType = ET.ActionRepeatType.Single; m_IsInterruptable = false; Preconditions.Add(HelpStrings.AI.CAN_ATTACK_PLAYER, true); Effects.Add(HelpStrings.AI.IS_PLAYER_DEAD, true); }
public GetThing(GOAPAgent agent, Game game, Thing thing, Movement movement, TypeOfThing resource) : base(agent, game, movement) { _thing = thing; _movement = movement; _resource = resource; _inventory = _thing.Inventory; Preconditions.Add(Effect.HAS_THING, TypeOfThing.None); Effects.Add(Effect.HAS_THING, resource); }
/// <summary> /// Default constructor /// </summary> public GoToAction() { var x = new NamedParameter("param1"); var y = new NamedParameter("param2"); var x2 = new NamedParameter("param3"); var y2 = new NamedParameter("param4"); Preconditions.Add(new Fact(Definitions.In, x, y)); AddList.Add(new Fact(Definitions.In, x2, y2)); DeleteList.Add(new Fact(Definitions.In, x, y)); }
public Construct(GOAPAgent agent, Game game, Movement movement, TypeOfThing resource, Thing thing) : base(agent, game, movement) { Goal = GOAPGoal.Goal.IS_WORKING; _movement = movement; _resource = resource; _thing = thing; _inventory = _thing.Inventory; Preconditions.Add(GOAPAction.Effect.HAS_THING, resource); }
/// <summary> /// Default constructor /// </summary> public SellGoldAction() { var x = new NamedParameter("param1"); var y = new NamedParameter("param2"); Preconditions.Add(new Fact(Definitions.HasGold, new ValueParameter(true))); Preconditions.Add(new Fact(Definitions.Town, x, y)); Preconditions.Add(new Fact(Definitions.In, x, y)); AddList.Add(new Fact(Definitions.HasGold, new ValueParameter(false))); DeleteList.Add(new Fact(Definitions.HasGold, new ValueParameter(true))); }
public GatherResource(Gather gather) { Gather = gather; foreach (ItemType i in Gather.Input) { Preconditions.Add(new Tuple <string, object>("HasItem", i), true); } Effects.Add(new Tuple <string, object>("HasItem", Gather.Output), true); Duration = Gather.Duration; Cost = Gather.Duration; }
public EastSomething(GOAPAgent agent, Game game, Thing thing) : base(agent, game) { _inventory = thing.Inventory; Goal = GOAPGoal.Goal.IS_NOT_HUNGRY; //Preconditions.Add(GOAPAction.Effect.IS_HUNGRY, true); Preconditions.Add(GOAPAction.Effect.HAS_EDIBLE_THING, true); //Effects.Add(GOAPAction.Effect.IS_HUNGRY, false); }
void Start() { ActionName = "Rest"; Cost = 1; Target = null; TargetTag = "BreakRoom"; Duration = 5; Preconditions.Add("IsExhausted", 0); //AfterEffects.Add("IsRested", 1); //e.x. Patient.s3 Agent = null; // bool Running }
void Start() {//Get Patient for Treatment ActionName = "Go To Cubicle"; Cost = 1; Target = null; TargetTag = null; Duration = 2; Preconditions.Add("PatientPickedUp", 1); //AfterEffects.Add("TreatPatient", 1) Agent = null; // bool Running }
void Start() { ActionName = "Register"; Cost = 1; Target = null; TargetTag = "Reception"; Duration = 5; Preconditions.Add("HasArrived", 0); //dictionary AfterEffects.Add("HasRegistered", 0) Agent = null; // bool Running }
void Start() { ActionName = "Go to Waiting Room"; Cost = 1; Target = null; TargetTag = "WaitingArea"; Duration = 0; Preconditions.Add("HasRegistered", 0); //dictionary AfterEffects.Add("IsWaiting", 0) Agent = null; // bool Running }
void Start() { ActionName = "GoHome"; Cost = 1; Target = null; TargetTag = "Home"; Duration = 0; Preconditions.Add("IsTreated", 1); //AfterEffects.Add("IsHome", 1); //e.x. Patient.s3 Agent = null; // bool Running }
public CreateItem(Recipe recipe) { Recipe = recipe; foreach (ItemType i in Recipe.Input) { Preconditions.Add(new Tuple <string, object>("HasItem", i), true); Effects.Add(new Tuple <string, object>("HasItem", i), false); } Effects.Add(new Tuple <string, object>("HasItem", Recipe.Output), true); Cost = Recipe.Duration; Duration = Recipe.Duration; }
/// <summary> /// Default constructor that initializes preconditions, add/delete list and constraints /// </summary> /// <param name="table">The table of our problem</param> public PutDownAction(Table table) { _table = table; var block = new NamedParameter("param1"); var goal1 = new Fact(Definitions.ArmHolds, block); Preconditions.Add(goal1); AddList.Add(new Fact(Definitions.ArmHolds, new ValueParameter(null))); AddList.Add(new Fact(Definitions.On, block, new ValueParameter(table))); AddList.Add(new Fact(Definitions.Clear, block)); DeleteList.Add(goal1); Constraints.Add(TypeCheck(typeof(Block), block)); }