private void tick(Ability self) { if (active) { addCharge(false); checkCharges(); } }
private string parseMessage(Ability abil, string message) { Regex rgx; Dictionary<string, string> lastMatch = new Dictionary<string, string>(); if (abil.lastMatch.Count > 0) { foreach (KeyValuePair<int, Dictionary<string, string>> collections in abil.lastMatch) { foreach (KeyValuePair<string, string> group in collections.Value) { lastMatch[group.Key] = group.Value; rgx = new Regex("\\$\\{" + Regex.Escape(group.Key) + "\\." + Regex.Escape(collections.Key.ToString()) + "\\}"); if (rgx.IsMatch(message)) { message = rgx.Replace(message, group.Value); } } } foreach (KeyValuePair<int, Dictionary<string, string>> collections in abil.lastMatch) { foreach (KeyValuePair<string, string> group in collections.Value) { rgx = new Regex("\\$" + Regex.Escape(group.Key)); message = rgx.Replace(message, group.Value); rgx = new Regex("\\$\\{" + Regex.Escape(group.Key) + "\\}"); message = rgx.Replace(message, group.Value); } } foreach (KeyValuePair<string, string> group in lastMatch) { rgx = new Regex("\\$\\{" + Regex.Escape(group.Key) + "\\.last\\}"); if (rgx.IsMatch(message)) { message = rgx.Replace(message, group.Value); } } } rgx = new Regex("\\$\\{[^\\}]+\\}"); message = rgx.Replace(message, ""); rgx = new Regex("\\$[^ ]+"); message = rgx.Replace(message, ""); return message; }
public void startTowers(Ability abil) { if (phase == 1) { P1TowerNumber++; switch (P1TowerNumber) { case 1: towers[Towers.dread].start(); towers[Towers.west].start(); if (calloutTowerStrategy) { tts("Team 1 to dreadnaught"); } else { tts("Tower set 1"); } break; case 2: towers[Towers.mine].start(); towers[Towers.west].start(); if (calloutTowerStrategy) { tts("Team 2 to mines"); } else { tts("Tower set 2"); } break; } } else if (phase == 2) { P2TowerNumber++; switch (P2TowerNumber) { case 1: towers[Towers.dread].start(); towers[Towers.west].start(); if (calloutTowerStrategy) { tts("Team 1 to dreadnaught"); } else { tts("Tower set 3"); } break; case 2: towers[Towers.mine].start(); towers[Towers.west].start(); if (calloutTowerStrategy) { tts("Team 2 to mines"); } else { tts("Tower set 4"); } break; case 3: towers[Towers.dread].start(); towers[Towers.mine].start(); if (calloutTowerStrategy) { tts("Team 1 to mines"); } else { tts("Tower set 5"); } break; } } else if (phase == 3) { P3TowerNumber++; switch (P3TowerNumber) { case 1: towers[Towers.mine].start(); towers[Towers.west].start(); towers[Towers.south].start(); if (calloutTowerStrategy) { tts("Two to west, one to south"); } else { tts("Tower set 6"); } break; case 2: towers[Towers.dread].start(); towers[Towers.mine].start(); towers[Towers.west].start(); if (calloutTowerStrategy) { tts("Two to mines, one to dreadnaught"); } else { tts("Tower set 7"); } break; case 3: towers[Towers.mine].start(); towers[Towers.west].start(); towers[Towers.south].start(); if (calloutTowerStrategy) { tts("Two to west, one to south"); } else { tts("Tower set 8"); } break; } } }