public ObjectiveType GetTypeObjective(int pIdObjectiveType) { ObjectiveType ob = new ObjectiveType(); string conn = "URI=file:" + Application.streamingAssetsPath + "/AdvScrabble.db"; //Path to database. IDbConnection dbconn; dbconn = (IDbConnection) new SqliteConnection(conn); dbconn.Open(); //Open connection to the database. IDbCommand dbcmd = dbconn.CreateCommand(); string sqlQuery = String.Format("SELECT * FROM objective_type where id_objective_type = \"{0}\"", pIdObjectiveType); dbcmd.CommandText = sqlQuery; IDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { ob.Id_type_objective = reader.GetInt32(0); ob.Description = reader.GetString(1); } dbcmd.Dispose(); dbcmd = null; dbconn.Close(); dbconn = null; return(ob); }
public override double GetObjectiveStrengthValue(ObjectiveType objectiveType) { if (objectiveType is Control) { return(0.7); } if (objectiveType is AssaultAttack) { return(1.2); } if (objectiveType is EscortAttack) { return(1.5); } if (objectiveType is EscortDefend) { return(1.5); } if (objectiveType is AssaultDefend) { return(0.7); } return(1.0); }
public Objective(string name, string description, ObjectiveType type) { Name = name; Description = description; Type = type; IsCompleted = false; }
private void AssignShipsToDefendObjective() { DefendPlanetObjective objective = this.m_Objective as DefendPlanetObjective; if (objective.DefendPatrolObjective != null) { int index = 0; foreach (Ship ship in this.m_Ships) { if (index < this.m_ShipControls.Count) { this.m_ShipControls[index].AddShip(ship, false); } else { Vector3 patrolDirection = objective.GetPatrolDirection(index); PatrolShipControl patrolShipControl = new PatrolShipControl(this.m_Game, (TacticalObjective)objective.DefendPatrolObjective, this.m_CommanderAI, this.m_PatrolType, patrolDirection, 10000f, this.m_CommanderAI.AIRandom.CoinToss(0.5)); patrolShipControl.AddShip(ship, false); this.m_ShipControls.Add((TaskGroupShipControl)patrolShipControl); } index = (index + 1) % 6; } } else { this.m_RequestedObjectiveType = ObjectiveType.PATROL; } }
public void CalculateGoals(ObjectiveType objective, params ConstraintType[] constraints) { var simplex = new SimplexSolver(); var goalEarned = GoalEarned; var objCoefficients = new Dictionary <object, double>(); var consCoefficients = new Dictionary <object, double>(); foreach (var section in sections) { var staticEarned = section.Assignments.Where(a => !a.GoalSelected).Sum(a => a.Earned); var totalWorth = section.Assignments.Sum(a => a.Worth); goalEarned -= section.Weight * 100 * (staticEarned / totalWorth); foreach (var assignment in section.Assignments) { if (assignment.GoalSelected) { var objCoefficient = objective == ObjectiveType.Equal ? 1 : section.Weight; objCoefficients.Add(assignment.Id, objCoefficient); var consCoefficient = section.Weight * 100 / totalWorth; consCoefficients.Add(assignment.Id, consCoefficient); var maxEarnedCoeff = new Dictionary <object, double>(); maxEarnedCoeff.Add(assignment.Id, 1); simplex.AddConstraint(maxEarnedCoeff, Relationship.LessThanOrEqual, assignment.GoalEarned); } } } simplex.SetObjective(Optimization.Min, objCoefficients); simplex.AddConstraint(consCoefficients, Relationship.GreaterThanOrEqual, goalEarned); simplex.Solve(out IDictionary <object, double> solution); // 100, 100, 36.923 }
public Tile(Vector2 position, Transform tileParent, TerrainType terrain, ObjectiveType objective) { Position = position; TileParent = tileParent; TerrainType = terrain; ObjectiveType = objective; }
public TaskGroup(App game, CombatAI commandAI) { this.m_Game = game; this.m_CommanderAI = commandAI; this.m_Objective = (TacticalObjective)null; this.m_Orders = TaskGroupOrders.None; this.m_Type = TaskGroupType.Aggressive; this.m_bIsPlayerOrder = false; this.m_bIsInContactWithEnemy = false; this.m_EnemyGroupInContact = (EnemyGroup)null; this.m_Ships = new List <Ship>(); this.m_Targets = new List <Ship>(); this.m_ShipControls = new List <TaskGroupShipControl>(); this.m_TargetGroup = (EnemyGroup)null; this.m_TargetTaskGroup = (TaskGroup)null; this.m_PatrolType = PatrolType.Circular; this.m_RequestedObjectiveType = ObjectiveType.NO_OBJECTIVE; this.m_NumShipTypes = new int[14]; for (int index = 0; index < 14; ++index) { this.m_NumShipTypes[index] = 0; } this.m_GroupSpeed = 0.0f; this.m_RequestRefreshShipControls = false; this.m_ChangeAttackTime = 4800; this.m_CurrentChangeAttackDelay = this.m_ChangeAttackTime; }
public QuestGoal(ObjectiveType type, int idOfObject, int need, string desc) { Type = type; ID = idOfObject; AmountNeed = need; AmountDid = 0; Description = desc; }
internal override void NotifyFilledObjective(ObjectiveType objectiveEntered) { if (objectivesFilled < objectivesOrder.Length && objectivesOrder[objectivesFilled] != objectiveEntered && objectivesOrder[objectivesFilled] != ObjectiveType.NONE) { Invoke("StartBlinking", 8.0f); } objectivesFilled++; }
public override double GetObjectiveStrengthValue(ObjectiveType objectiveType) { if (objectiveType is Control) { return(0.7); } return(1.0); }
/// <summary> /// Initializes a new instance of the <see cref="Objective"/> class. /// <para></para> /// <remarks><paramref name="description"></paramref> -The description of the objective.</remarks> /// <para></para> /// <remarks><paramref name = "type" ></paramref > -The type of the objective.</remarks> /// <para></para> /// <remarks><paramref name="completed"></paramref> -The boolean whether the objective is completed or not.</remarks> /// <para></para> /// <remarks><paramref name="startingmin"></paramref> -The integer to start the current objectives count with.</remarks> /// <para></para> /// <remarks><paramref name="startingmax"></paramref> -The integer to start the current objectives max count with.</remarks> /// </summary> public Objective(string description, ObjectiveType type, bool completed, int startingmin, int startingmax) { this.description = description; this.type = type; this.iscompleted = completed; this.currentvalue = startingmin; this.maxvalue = startingmax; }
public override double GetObjectiveStrengthValue(ObjectiveType objectiveType) { if (objectiveType is EscortAttack) { return(1.5); } return(1.0); }
public void SetObjective(string objStr, float x, float y) { currentObjective = ObjectiveType.Reach; float h = CLevel.Instance.GetHeightAt(x, y, 999); Target = CObjectManager.Instance.CreateInstance(typeof(CCheckpoint), x, h, y); sObjectiveString = objStr; }
public void SetTarget(Vector3 position) { Target = null; TPX = position.x; TPY = position.y; TPZ = position.z; Type = ObjectiveType.Position; }
public void SetTarget(Vector3 position, Vector3 direction) { Target = null; TPX = position.x; TPY = position.y; TPZ = position.z; Direction = direction; Type = ObjectiveType.LookAt; }
public void SetTarget(Quaternion rotation) { Target = null; TRX = rotation.x; TRY = rotation.y; TRZ = rotation.z; TRW = rotation.w; Type = ObjectiveType.Orientation; }
public override double GetObjectiveStrengthValue(ObjectiveType objectiveType) { if (objectiveType is AssaultDefend) { return(0.7); } return(1.0); }
public void SetObjective(string objStr, List <string> dialog, List <string> subtitles) { currentObjective = ObjectiveType.Event; sObjectiveString = objStr; DialogSoundBytes = dialog; DialogSubtitles = subtitles; }
/// @param type /// The type of objective targetted /// @param amount /// The progressed amount for that objective /// public void LogEvent(ObjectiveType type, int amount = 1) { foreach (var objective in m_objectives) { if (objective.m_data.m_type == type) { objective.AddProgress(amount); } } }
/// @param type /// The type of objective targetted /// @param value /// The value of the event /// @param amount /// The progressed amount for that objective /// public void LogEventWithValue(ObjectiveType type, int value = 1, int amount = 1) { foreach (var objective in m_objectives) { if (objective.m_data.m_type == type && objective.m_data.m_value <= value) { objective.AddProgress(amount); } } }
public Objective(ObjectiveType type, String text, String shorttext) { this.type = type; this.text = text; locationTriggers = new List<string>(); targetBosses = new List<string>(); upgradeGoals = new List<AbilityType>(); this.shorttext = shorttext; this.longtext = text; }
/// @param type /// The type of objective targetted /// @param target /// The target of the event /// @param amount /// The progressed amount for that objective /// public void LogEvent(ObjectiveType type, TileColour target, int amount = 1) { foreach (var objective in m_objectives) { if (objective.m_data.m_type == type && objective.m_data.m_target == target) { objective.AddProgress(amount); } } }
private bool CheckObjective(QuestObjective questObjective, ObjectiveType targetObjective) { if (questObjective.Objective == targetObjective) { return(true); } else { return(false); } }
private void miAddMapInfo_Click(object sender, EventArgs e) { ObjectiveType c = (ObjectiveType)tvManifest.SelectedNode.Tag; ObjectiveTypeMapInfo o = new ObjectiveTypeMapInfo(); c.mapInfo.Add(o); Forms.PropertyEditor.Show(o); tvManifest.SelectedNode.Expand(); }
/// <inheritdoc /> public override void Decode(MinecraftStream stream) { ObjectiveName = stream.ReadString(); Mode = (ObjectiveMode)stream.ReadByte(); if (Mode == ObjectiveMode.Create || Mode == ObjectiveMode.UpdateText) { Value = stream.ReadChatObject(); Type = (ObjectiveType)stream.ReadByte(); } }
public void SetTarget(Vector3 position, Quaternion rotation) { Target = null; TPX = position.x; TPY = position.y; TPZ = position.z; TRX = rotation.x; TRY = rotation.y; TRZ = rotation.z; TRW = rotation.w; Type = ObjectiveType.Pose; }
public static readonly TextDefinition CompletionNoticeCraft = new TextDefinition(1073967); // You obtained what you seek, now receive your reward. public MLQuest() { m_Activated = false; m_Objectives = new List <BaseObjective>(); m_ObjectiveType = ObjectiveType.All; m_Rewards = new List <BaseReward>(); m_CompletionNotice = CompletionNoticeDefault; m_Instances = new List <MLQuestInstance>(); m_SaveEnabled = true; }
/// <summary> /// This resource returns details about World vs. World objectives such as camps, towers, and keeps. /// </summary> /// <param name="id">The objective id.</param> /// <param name="name">The name of the objective.</param> /// <param name="sector_id">The map sector the objective can be found in. (See /v2/continents.)</param> /// <param name="type">The type of the objective</param> /// <param name="map_type">The map that this objective can be found on</param> /// <param name="map_id">The ID of the map that this objective can be found on.</param> /// <param name="coord">An array of three numbers representing the X, Y and Z coordinates of the objectives marker on the map.</param> /// <param name="label_coord">An array of two numbers representing the X and Y coordinates of the sector centroid.</param> /// <param name="marker">The icon link</param> public Objectives(string id, string name, int sector_id, ObjectiveType type, MapType map_type, int map_id, float[] coord, float[] label_coord, string marker) : base(marker) { Id = id; Name = name; SectorId = sector_id; Type = type; MapType = map_type; MapId = map_id; Coord = coord; LabelCoord = label_coord; }
public bool isObjectiveCompleted(ObjectiveType type) { foreach (PlayerObjectiveModel pom in objectives) { if (pom.type == type) { return(true); } } return(false); }
public int Add(Player player, string description, ObjectiveType type = ObjectiveType.Primary, bool inhibitAnnouncement = false) { var newID = objectives.Count; objectives.Insert(newID, new MissionObjective(type, description)); ObjectiveAdded(player, inhibitAnnouncement); foreach (var inou in player.PlayerActor.TraitsImplementing<INotifyObjectivesUpdated>()) inou.OnObjectiveAdded(player, newID); return newID; }
public Objective GenerateObjective(ObjectiveType type, ObjectiveDifficultyLevel difficulty, GameObject source) { switch (type) { case ObjectiveType.KILL: return(GenerateKillObjective(difficulty, source)); case ObjectiveType.SURVIVE: return(GenerateSurviveObjective(difficulty, source)); } return(null); }
public static EventDataModel getCombatEvent(Encounter encounter, ObjectiveType objective = ObjectiveType.None) { EventDataModel edm = new EventDataModel(); edm.encounter = encounter; edm.hasMessage = false; edm.message = string.Empty; edm.type = EventDataType.Combat; edm.nextEvent = null; edm.objective = objective; return(edm); }
public static string getCompletedText(ObjectiveType type) { switch (type) { case ObjectiveType.EmergenceCavernAdditionalAdventurer: return "You have unlocked an additional character! You will be able to add them to your party the next time you enter a dungeon."; case ObjectiveType.EmergenceCavernB2: return "You have unlocked Emergence Cavern B2."; case ObjectiveType.Potion: return "The Potion item is now available at the Item Store. Please note that item uses regenerate when exiting a dungeon."; default: return string.Empty; } }
public static string completeObjective(PlayerModel pm, ObjectiveType objective) { if (!pm.isObjectiveCompleted(objective)) { if (objective == ObjectiveType.EmergenceCavernAdditionalAdventurer) { PlayerDataManager.addCharacter(pm); } pm.objectives.Add(new PlayerObjectiveModel() { type = objective }); return getCompletedText(objective); } return string.Empty; }
public void UpdateObjective(ObjectiveType type, float value) { foreach (Objective objective in secondary_objectives) { if(objective.type == type){ objective.UpdateObjective(value); } } if(primary_objective.type == type){ primary_objective.UpdateObjective(value); } }
public MissionObjective(ObjectiveType type, string description) { Type = type; Description = description; State = ObjectiveState.Incomplete; }
public Objective() { // Default constructor type = ObjectiveType.NONE; reward = ObjectiveReward.NONE; current = 0; target = 1; completed = false; reward_amount = 0; }
public Objective(ObjectiveType set_type, ObjectiveReward set_reward, int set_target, int amount) { SetObjective (set_type, set_reward, set_target,amount); }
public void SetObjective(ObjectiveType set_type, ObjectiveReward set_reward, int set_target, int amount) { type = set_type; reward = set_reward; target = (float)set_target; current = 0; completed = false; reward_amount = amount; done = false; }
public Objective(List<Destructible> Targets) { Type = ObjectiveType.MultipleTargets; this.targets = Targets; }
/// <summary> /// Handles the objective. /// </summary> /// <param name="unit">The unit.</param> /// <param name="type">The type.</param> private void HandleObjective(Obj_AI_Base unit, ObjectiveType type) { if ((Config.Instance.objectiveMenu["SmartObjectiveSteal"].Cast<CheckBox>().CurrentValue && !Config.Instance.objectiveMenu["StealObjectiveKeyBind"].Cast<CheckBox>().CurrentValue && unit.CountAlliesInRange(500) != 0) || !Config.Instance.objectiveMenu["StealObjectiveKeyBind"].Cast<CheckBox>().CurrentValue) { return; } if (!Config.Instance.objectiveMenu["Steal" + type].Cast<CheckBox>().CurrentValue) { return; } this.StealObject(unit, StealType.ObjectiveSteal); }
public static EventDataModel getCombatEvent(Encounter encounter, ObjectiveType objective = ObjectiveType.None) { EventDataModel edm = new EventDataModel(); edm.encounter = encounter; edm.hasMessage = false; edm.message = string.Empty; edm.type = EventDataType.Combat; edm.nextEvent = null; edm.objective = objective; return edm; }
public Objective(ObjectiveType type, string text, ObjectiveStatus status) { Type = type; Text = text; Status = status; }
public bool isObjectiveCompleted(ObjectiveType type) { foreach (PlayerObjectiveModel pom in objectives) { if (pom.type == type) { return true; } } return false; }
/// <summary> /// Fires the object created event. /// </summary> /// <param name="unit">The unit.</param> /// <param name="type">The type.</param> private static void FireObjectCreatedEvent(Obj_AI_Base unit, ObjectiveType type) { OnObjectiveCreated?.Invoke(unit, type); }
public Objective(float TimeLimit) { Type = ObjectiveType.ClearAll; timeLimit = TimeLimit; currentTime = 0f; }
public static EventDataModel getMultiCombatEvent(List<Encounter> encounters, ObjectiveType objective = ObjectiveType.None) { EventDataModel edm = new EventDataModel(); edm.hasMessage = false; edm.message = string.Empty; edm.type = EventDataType.Combat; edm.objective = objective; EventDataModel currentEvent = edm; foreach (Encounter encounter in encounters) { currentEvent.encounter = encounter; EventDataModel edm2 = new EventDataModel(); edm2.encounter = encounter; edm2.hasMessage = false; edm2.message = string.Empty; edm2.type = EventDataType.Combat; edm2.nextEvent = null; edm2.objective = objective; currentEvent.nextEvent = edm2; currentEvent = edm2; } return edm; }
/// <summary> /// Handles the buff. /// </summary> /// <param name="unit">The unit.</param> /// <param name="type">The type.</param> private void HandleBuff(Obj_AI_Base unit, ObjectiveType type) { if (!Config.Instance.buffMenu["Steal" + type + "Buff"].Cast<CheckBox>().CurrentValue) { return; } var alliesinRange = unit.CountAlliesInRange(1000); if (!Config.Instance.buffMenu["StealAllyBuffs"].Cast<CheckBox>().CurrentValue && alliesinRange > 0) { return; } this.StealObject(unit, StealType.BuffSteal); }
public void SetRandomObjective(int level) { type = (ObjectiveType)Random.Range (1, 5); reward_amount = Random.Range (20 * level, 30 * level); if (type == ObjectiveType.DAMAGE){ target = Random.Range(level, level*5); reward = ObjectiveReward.GAINZ; } else if (type == ObjectiveType.KILL){ target = Random.Range(level * 10, level * 20); reward = ObjectiveReward.GAINZ; } else if (type == ObjectiveType.SCAVENGER){ target = Random.Range(level, level*2); reward = ObjectiveReward.BRAINZ; } else if (type == ObjectiveType.FIRE){ target = Random.Range (10*level, 20*level); reward = ObjectiveReward.BRAINZ; } }
public static EventDataModel getTrapEvent(EventDataType eventDataType, string message, ObjectiveType objective = ObjectiveType.None) { EventDataModel edm = new EventDataModel(); edm.hasMessage = true; edm.message = message; edm.type = eventDataType; edm.nextEvent = null; edm.objective = objective; return edm; }
public Objective(Destructible Target) { Type = ObjectiveType.TargetDestructible; targets = new List<Destructible>(); targets.Add(Target); }