public override void Update(Task caller) { base.Update(caller); // Add related Person or Foe resource if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name)) { Person person = ParentQuest.GetPerson(personSymbol); if (person != null) { DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(person); } } else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name)) { Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe != null) { DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(foe); } } // Popup saying message if (sayingID != 0) { ParentQuest.ShowMessagePopup(sayingID); } SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Create SiteLink if not already present if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol)) { QuestMachine.CreateSiteLink(ParentQuest, placeSymbol); } // Attempt to get Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("Could not find Foe resource symbol {0}", foeSymbol)); } // Attempt to get Place resource Place place = ParentQuest.GetPlace(placeSymbol); if (place == null) { SetComplete(); throw new Exception(string.Format("Could not find Place resource symbol {0}", placeSymbol)); } // Assign Foe to Place place.AssignQuestResource(foeSymbol, marker); SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Get related Foe resource Foe foe = ParentQuest.GetFoe(npcSymbol); if (foe == null) { return; } foreach (DaggerfallEnemy enemy in UnityEngine.Object.FindObjectsOfType <DaggerfallEnemy>()) { if (enemy.QuestSpawn) { QuestResourceBehaviour qrb = enemy.GetComponent <QuestResourceBehaviour>(); if (qrb && qrb.TargetSymbol == foe.Symbol) { qrb.IsAttackableByAI = isAttackableByAI; SetComplete(); } } } return; }
public override void Update(Task caller) { base.Update(caller); // Get related Foe resource Foe foe = ParentQuest.GetFoe(npcSymbol); if (foe == null) { return; } foreach (DaggerfallEnemy enemy in UnityEngine.Object.FindObjectsOfType <DaggerfallEnemy>()) { if (enemy.QuestSpawn) { QuestResourceBehaviour qrb = enemy.GetComponent <QuestResourceBehaviour>(); if (qrb && qrb.TargetSymbol == foe.Symbol) { DaggerfallEntityBehaviour deb = enemy.GetComponent <DaggerfallEntityBehaviour>(); if (deb) { EnemyEntity enemyEntity = deb.Entity as EnemyEntity; //Debug.Log("Changed team from " + enemyEntity.Team + " to " + (MobileTeams)teamNumber); enemyEntity.Team = (MobileTeams)teamNumber; SetComplete(); } } } } }
void CreatePendingFoeSpawn() { // Get the Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("create foe could not find Foe with symbol name {0}", Symbol.Name)); } // Get foe GameObjects pendingFoeGameObjects = GameObjectHelper.CreateFoeGameObjects(Vector3.zero, foe.FoeType, foe.SpawnCount, MobileReactions.Hostile, foe); if (pendingFoeGameObjects == null || pendingFoeGameObjects.Length != foe.SpawnCount) { SetComplete(); throw new Exception(string.Format("create foe attempted to create {0}x{1} GameObjects and failed.", foe.SpawnCount, Symbol.Name)); } // Initiate deployment process // Usually the foe will spawn immediately but can take longer depending on available placement space // This process ensures these foes have all been deployed before starting next cycle spawnInProgress = true; pendingFoesSpawned = 0; }
public override bool CheckTrigger(Task caller) { // Always return true once owning Task is triggered // Another action will need to rearm/unset this task if another click is required if (caller.IsTriggered) { return(true); } // Get related Foe resource Foe foe = ParentQuest.GetFoe(npcSymbol); if (foe == null) { return(false); } // Check player clicked flag if (foe.HasPlayerClicked) { // When a gold amount and task is specified, the player must have that amount of gold or another task is called if (goldAmount > 0 && taskSymbol != null && !string.IsNullOrEmpty(taskSymbol.Name)) { // Does player have enough gold? if (GameManager.Instance.PlayerEntity.GoldPieces >= goldAmount) { // Then deduct gold and fire trigger GameManager.Instance.PlayerEntity.GoldPieces -= goldAmount; } else { // Otherwise trigger secondary task and exit without firing trigger ParentQuest.StartTask(taskSymbol); return(false); } } if (id != 0) { ParentQuest.ShowMessagePopup(id); } // Rearm foe click after current task ParentQuest.ScheduleClickRearm(foe); return(true); } return(false); }
public override void Update(Task caller) { // Get related Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { return; } // Raise the restrained flag foe.SetRestrained(); SetComplete(); }
public override void Update(Task caller) { base.Update(caller); // Attempt to get Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("Could not find Foe resource symbol {0}", foeSymbol)); } foe.IsHidden = true; SetComplete(); }
public override void Update(Task caller) { // Get the Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("CastSpellOnFoe could not find Foe with symbol name {0}", Symbol.Name)); } // Add spell to Foe resource queue foe.QueueSpell(spell); SetComplete(); }
public override bool CheckTrigger(Task caller) { // Get related Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { return(false); } // Check injured flag if (foe.InjuredTrigger) { return(true); } return(false); }
public override bool CheckTrigger(Task caller) { // Get related Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) return false; // Check total kills recorded on this Foe if (foe.KillCount >= killsRequired) { // Popup saying message if (sayingID != 0) ParentQuest.ShowMessagePopup(sayingID); return true; } return false; }
void SpawnFoe() { // Roll for spawn chance float chance = spawnChance / 100f; if (UnityEngine.Random.Range(0f, 1f) < chance) { return; } // Get the Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { throw new Exception(string.Format("create foe could not find Foe with symbol name {0}", Symbol.Name)); } // Get game objects GameObject[] gameObjects = foe.CreateFoeGameObjects(Vector3.zero); if (gameObjects == null || gameObjects.Length != foe.SpawnCount) { throw new Exception(string.Format("create foe attempted to spawn {0}x{1} and failed.", foe.SpawnCount, Symbol.Name)); } // For simple initial testing just place enemies 2m behind player // Will eventually need to spawn enemy within a certain radius of player // and ensure not dropped into the void for dungeons and building interiors GameObject player = GameManager.Instance.PlayerObject; Vector3 position = player.transform.position + (-player.transform.forward * 2); for (int i = 0; i < gameObjects.Length; i++) { gameObjects[i].transform.position = position; gameObjects[i].SetActive(true); } }
public override bool CheckTrigger(Task caller) { // Get related Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { return(false); } // Check injured flag if (foe.InjuredTrigger) { // Optionally show message if (textID != 0) { ParentQuest.ShowMessagePopup(textID); } return(true); } return(false); }
public override void Update(Task caller) { base.Update(caller); // Drop related Person or Foe resource if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name)) { Person person = ParentQuest.GetPerson(personSymbol); if (person != null) { DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(person); } } else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name)) { Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe != null) { DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(foe); } } SetComplete(); }
public override void Update(Task caller) { ulong gameSeconds = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToSeconds(); // Init spawn timer on first update if (lastSpawnTime == 0) { lastSpawnTime = gameSeconds + (uint)UnityEngine.Random.Range(0, spawnInterval + 1); } // Do nothing if max foes already spawned // This can be cleared on next set/rearm if (spawnCounter >= spawnMaxTimes && spawnMaxTimes != -1) { return; } // Clear pending foes if all have been spawned if (spawnInProgress && pendingFoesSpawned >= pendingFoeGameObjects.Length) { spawnInProgress = false; spawnCounter++; return; } // Check for a new spawn event - only one spawn event can be running at a time if (gameSeconds > lastSpawnTime + spawnInterval && !spawnInProgress) { // Update last spawn time lastSpawnTime = gameSeconds; // Roll for spawn chance float chance = spawnChance / 100f; if (UnityEngine.Random.Range(0f, 1f) > chance) { return; } // Get the Foe resource Foe foe = ParentQuest.GetFoe(foeSymbol); if (foe == null) { SetComplete(); throw new Exception(string.Format("create foe could not find Foe with symbol name {0}", Symbol.Name)); } // Do not spawn if foe is hidden if (foe.IsHidden) { return; } // Start deploying GameObjects CreatePendingFoeSpawn(foe); } // Try to deploy a pending spawns if (spawnInProgress) { TryPlacement(); GameManager.Instance.RaiseOnEncounterEvent(); } }