fun collectAndFireTriggers( players: HashSet<PlayerID?>?, triggerMatch: Match<TriggerAttachment?>?, aBridge: IDelegateBridge?, beforeOrAfter: String?, stepName: String? ) { val toFirePossible: HashSet<TriggerAttachment> = collectForAllTriggersMatching(players, triggerMatch, aBridge) if (toFirePossible.isEmpty()) { return } val testedConditions: HashMap<ICondition, Boolean> = collectTestsForAllTriggers(toFirePossible, aBridge) val toFireTestedAndSatisfied: List<TriggerAttachment> = Match.getMatches( toFirePossible, AbstractTriggerAttachment.isSatisfiedMatch(testedConditions) ) if (toFireTestedAndSatisfied.isEmpty()) { return } TriggerAttachment.fireTriggers( HashSet(toFireTestedAndSatisfied), testedConditions, aBridge, beforeOrAfter, stepName, true, true, true, true ) }
This will collect all triggers for the desired players , based on a match provided , and then it will gather all the conditions necessary , then test all the conditions , and then it will fire all the conditions which are satisfied .