public static void TriggerEvent() { Game game = Game.Get(); RoundHelper.CheckNewRound(); if (game.eventList.Count == 0) { return; } QuestData.Event e = game.eventList.Pop(); // If the flags are not set do not trigger event foreach (string s in e.flags) { if (!game.qd.flags.Contains(s)) { return; } } // Add set flags foreach (string s in e.setFlags) { if (!game.qd.flags.Contains(s)) { Debug.Log("Notice: Setting quest flag: " + s); game.qd.flags.Add(s); } } // Remove clear flags foreach (string s in e.clearFlags) { if (game.qd.flags.Contains(s)) { Debug.Log("Notice: Clearing quest flag: " + s); game.qd.flags.Remove(s); } } // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog")) { Object.Destroy(go); } // If this is a monster event then add the monster group if (e is QuestData.Monster) { QuestData.Monster qm = (QuestData.Monster)e; // Is this type new? Game.Monster oldMonster = null; foreach (Game.Monster m in game.monsters) { if (m.monsterData.name.Equals(qm.mData.name)) { oldMonster = m; } } // Add the new type if (oldMonster == null) { game.monsters.Add(new Game.Monster(qm)); game.monsterCanvas.UpdateList(); } else if (qm.unique) { oldMonster.unique = true; oldMonster.uniqueText = qm.uniqueText; oldMonster.uniqueTitle = qm.uniqueTitle; } // Display the location game.tokenBoard.AddMonster(qm); } if (e.highlight) { game.tokenBoard.AddHighlight(e); } new DialogWindow(e); foreach (string s in e.addComponents) { if (game.qd.components.ContainsKey(s)) { game.qd.components[s].SetVisible(true); } else { Debug.Log("Warning: Attempting to show missing item: " + s); } } foreach (string s in e.removeComponents) { if (game.qd.components.ContainsKey(s)) { game.qd.components[s].SetVisible(false); } else { Debug.Log("Warning: Attempting to hide missing item: " + s); } } if (e.locationSpecified) { CameraController.SetCamera(e.location); } }
public void TriggerEvent() { RoundHelper.CheckNewRound(); if (eventStack.Count == 0) { return; } Event e = eventStack.Pop(); currentEvent = e; // Event may have been disabled since added if (e.Disabled()) { return; } // Add set flags foreach (string s in e.qEvent.setFlags) { Debug.Log("Notice: Setting quest flag: " + s + System.Environment.NewLine); game.quest.flags.Add(s); } // Remove clear flags foreach (string s in e.qEvent.clearFlags) { Debug.Log("Notice: Clearing quest flag: " + s + System.Environment.NewLine); game.quest.flags.Remove(s); } // If a dialog window is open we force it closed (this shouldn't happen) foreach (GameObject go in GameObject.FindGameObjectsWithTag("dialog")) { Object.Destroy(go); } // If this is a monster event then add the monster group if (e is MonsterEvent) { // Set monster tag if not already game.quest.flags.Add("#monsters"); MonsterEvent qe = (MonsterEvent)e; // Is this type new? Quest.Monster oldMonster = null; foreach (Quest.Monster m in game.quest.monsters) { if (m.monsterData.name.Equals(qe.cMonster.name)) { oldMonster = m; } } // Add the new type if (oldMonster == null) { game.quest.monsters.Add(new Quest.Monster(qe)); game.monsterCanvas.UpdateList(); } // There is an existing tpye, but now it is unique else if (qe.qMonster.unique) { oldMonster.unique = true; oldMonster.uniqueText = qe.qMonster.uniqueText; oldMonster.uniqueTitle = qe.GetUniqueTitle(); } // Display the location game.tokenBoard.AddMonster(qe); } if (e.qEvent.highlight) { game.tokenBoard.AddHighlight(e.qEvent); } game.quest.Add(e.qEvent.addComponents); game.quest.Remove(e.qEvent.removeComponents); game.quest.threat += e.qEvent.threat; if (e.qEvent.absoluteThreat) { if (e.qEvent.threat != 0) { Debug.Log("Setting threat to: " + e.qEvent.threat + System.Environment.NewLine); } game.quest.threat = e.qEvent.threat; } else if (e.qEvent.threat != 0) { Debug.Log("Changing threat by: " + e.qEvent.threat + System.Environment.NewLine); } foreach (QuestData.Event.DelayedEvent de in e.qEvent.delayedEvents) { game.quest.delayedEvents.Add(new QuestData.Event.DelayedEvent(de.delay + game.quest.round, de.eventName)); } if (e.qEvent.locationSpecified) { CameraController.SetCamera(e.qEvent.location); } // Only raise dialog if there is text, otherwise auto confirm if (e.GetText().Length == 0) { EndEvent(); } else { new DialogWindow(e); } }