public AddChatiment(int value, int element, int duration, Fights.Fighter fighter, Engines.Spells.SpellLevel spell) : base(duration, true, fighter) { this.Element = element; this.Value = value; this.Spell = spell; }
private IFight CreateNewFight() { var fight = new Fight(YouAre, CharResolver); Fights.Add(fight); return(fight); }
private void DoCombat(object sender, ElapsedEventArgs e) { //Server.Current.Log("DoCombat"); foreach (var combat in Fights.ToArray()) { try { if (combat.Fighting) // could've ended on another thread { combat.Round(_combatTickRate); } } catch (Exception ex) { throw ex; } // end fight if (!combat.Fighting) { combat.End(); Fights.Remove(combat); } } }
private IFight GetOrAddFight(Character mob) { return(Fights .Where(x => IsValidFight(x, mob)) .FirstOrDefault() ?? CreateNewFight()); }
public void AddFight(Fight fight) { Fight fightToChange; if (fight.FightId == 0) { var TimeParam = new SqlParameter("@Time", fight.Time); var RoundsPram = new SqlParameter("@Rounds", fight.Rounds); var WinnerIdParam = new SqlParameter("@WinnerId", fight.Winner.Id); var LosserIdParam = new SqlParameter("@LosserId", fight.Losser.Id); var Judge1Param = new SqlParameter("@Judge1", fight.Judge1); var Judge2Param = new SqlParameter("@Judge2", fight.Judge2); var Judge3Param = new SqlParameter("@Judge3", fight.Judge3); Database.ExecuteSqlCommand("exec AddFight @Time, @Rounds, @WinnerId, @LosserId," + "@Judge1, @Judge2, @Judge3", TimeParam, RoundsPram, WinnerIdParam, LosserIdParam, Judge1Param, Judge2Param, Judge3Param); } else if ((fightToChange = Fights.Where(f => f.FightId == fight.FightId).FirstOrDefault()) != null) { fightToChange.Judge1 = fight.Judge1; fightToChange.Judge2 = fight.Judge2; fightToChange.Judge3 = fight.Judge3; fightToChange.Time = fight.Time; fightToChange.Winner = fight.Winner; fightToChange.Losser = fight.Losser; fightToChange.Rounds = fight.Rounds; this.SaveChanges(); } }
/// <summary> /// This method finds posthumous damage due to a DoT /// </summary> private bool TryGetAppropriateFightDueToPosthumousDamageOverTimeFromAttacker(Hit line, out IFight fight) { fight = null; if (line.Type != AttackType.DamageOverTime) { return(false); } if (line.Attacker == Character.Unknown) { return(false); } // If there is an attacker and it's not a corpse, then this isn't posthumous damage if (!line.Attacker.IsDead) { return(false); } // If a mob casted a Dot on you before they died, it can still be causing damage after the mob itself dies. // This is indicated by taking damage from "a mob's corpse" // "You have taken 57121 damage from Dread Admiral's Curse by Arisen Gloriant Kra`du's corpse." // "Khadajitwo has taken 56242 damage from Dread Admiral's Curse by Arisen Gloriant Kra`du." // A complication to this however, is a merc's DoT damage line does not have the "attacker" either before nor after a mob dies. // "Vryklak has taken 28350 damage by Aura of the Kar`Zok." // Yet a further complication arises when a DoT is cured and you take one last tick of damage but without the attacker named // "You have taken 768 damage from Rabid Anklebite by Deathfang's corpse." // "Jathenai begins casting Counteract Disease." // "Jathenai begins casting Counteract Disease." // "You feel better." // "You have taken 768 damage from Rabid Anklebite." // So, this is now damage due to a dead attacker, let's try to find that last fight/attacker var mobFight = Fights.LastOrDefault(x => x.PrimaryMob == line.Attacker); // Check the line.DamageBy to find a DoT that matches // if we find a dead mob who has used that Dot in the fight, then we know we've got the right one // If a group member has the same type of DoT as we do, that's the same mob // If can happen that we don't take the DoT damage until after they die, in which case we're just matching the mob // Is it enough to just say it's the same mob? // - Yes if (mobFight != null) { fight = mobFight; return(true); } return(false); }
public void AddFight(Fights.Fight fight) { /* * Client.Send("Gc+" & Fight.BladesPattern) Client.Send("Gt" & Fight.TeamPattern(0)) Client.Send("Gt" & Fight.TeamPattern(1)) * */ }
/// <summary> /// </summary> public void Clear() { Fights.Clear(); Overall.Clear(); Party.Clear(); Monster.Clear(); InitStats(); }
public int NextNpcID() { var i = -1; while (Npcs.Any(x => x.ID == i) || MonstersGroups.Any(x => x.ID == i) || Fights.Any(x => x.GetFighters().ToList().Any(y => y.ID == i))) { i -= 1; } return(i); }
public void StartFight(int id) { Fight fight = Fights.FindFight(id); if (fight == null) { Debug.Log("Unknown fight id " + id.ToString()); return; } StartCoroutine(FadeToBlack(fight)); }
public int NextFightID() { var i = 1; while (Fights.Any(x => x.ID == i)) { i++; } return(i); }
private IFight GetAppropriateFight(Character char1, Character char2) { if (!Fights.Any()) { CreateNewFight(); } // If the primary mob isn't established yet, use the first fight var fight = Fights.First(); if (IsValidFight(fight, Character.Unknown)) { return(fight); } var firstActiveFight = Fights.Where(x => !x.IsFightOver); // If either one of the characters is Unknown, just use the first active fight if ((char1 == Character.Unknown || char2 == Character.Unknown) && firstActiveFight.Any()) { return(firstActiveFight.First()); } // If the char is a MOB, find the matching fight or create a new one if (CharResolver.WhichType(char1) == CharacterResolver.Type.NonPlayerCharacter) { return(GetOrAddFight(char1)); } if (CharResolver.WhichType(char2) == CharacterResolver.Type.NonPlayerCharacter) { return(GetOrAddFight(char2)); } // See if either character is already the primary mob (we can't tell if a named mob w/ a single name is a mob, so this may catch that) var primaryMobMatch = Fights.Where(x => IsValidFight(x, char1) || IsValidFight(x, char2)); if (primaryMobMatch.Any()) { return(primaryMobMatch.First()); } // Either the characters are not MOBs or one of them is a named Mob and we don't know it, just use the first fight that's still ongoing if (firstActiveFight.Any()) { return(firstActiveFight.First()); } return(CreateNewFight()); }
public Fight Fight() { var oldScore = CurrentScore; var fight = new MPQSim.Fight() { Node = Node, Time = Owner.Owner.CurrentTime, Score = oldScore }; Fights.Add(fight); return fight; }
private IFight GetAppropriateFight(Heal line) { // A heal line just applies to the last fight // It's a PC/Merc that's healing another PC/Merc // Except when it's a mob healing itself ... or healing a companion fighter... // Would a PC ever heal a Mob or vice versa? Maybe for a charmed pet ... but that's going to be a pain in the ass anyway if (Fights.Any() && (IsCharacterPlayerOrMerc(line.Healer) || IsCharacterPlayerOrMerc(line.Patient))) { // Apply the heal to the first active fight, or the last fight (that's inactive) return(Fights.FirstOrDefault(x => !x.IsFightOver) ?? Fights.Last()); } return(GetAppropriateFight(line.Healer, line.Patient)); }
/// <summary> /// This method finds fight with similar damage due to an anonymous DoT /// </summary> private bool TryGetAppropriateFightFromAnonymousDamageOverTime(Hit line, out IFight fight, out Attack newLineWithAttacker) { fight = null; newLineWithAttacker = null; if (line.Type != AttackType.DamageOverTime) { return(false); } if (line.Attacker != Character.Unknown) { return(false); } // This is usually DoT damage on a merc, there is no attacker either while the mob is still alive or after they're dead // "Vryklak has taken 28350 damage by Aura of the Kar`Zok." // It can also be DoT damage on you after a cure // "You have taken 768 damage from Rabid Anklebite by Deathfang's corpse." // "Jathenai begins casting Counteract Disease." // "Jathenai begins casting Counteract Disease." // "You feel better." // "You have taken 768 damage from Rabid Anklebite." // Search through our fights to find one that has the same DamageBy var mobFight = Fights.LastOrDefault(x => x.Statistics.Hit.Lines.Any(y => y.DamageBy == line.DamageBy)); // So, we didn't find any fight that matches the type of DoT damage for this line // We need to assign it to some fight, so let's assign it to the current fight (even if that fight is "over", i.e. mob is slain) if (mobFight == null) { mobFight = Fights.LastOrDefault(); } if (mobFight != null) { fight = mobFight; newLineWithAttacker = new Hit(line.LogLine, mobFight.PrimaryMob.Name, line.Defender.Name, line.Verb, line.Damage, line.DamageType, line.DamageBy, line.DamageQualifier, line.Zone); return(true); } return(false); }
public async Task <ReportTable> GetReportResults(bool getLastFight, string view = "damage-done") { List <Reports> reports = await GetReportsFromGuild(); Fights fights = GetFights(reports[0].id); List <Fight> bossFights = new List <Fight>(); foreach (Fight fight in fights.fights) { if (fight.boss != 0) { bossFights.Add(fight); } } string url = $"/report/tables/{view}/{reports[0].id}?start={bossFights[0].start_time}&end={bossFights[0].end_time}&"; ReportTable table = JsonConvert.DeserializeObject <ReportTable>(LogsApiRequest(url)); return(table); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { Fights.Dispose(); Bid.Dispose(); Roleplay.Dispose(); Flood.Dispose(); CharacterCreation.Dispose(); } Fights = null; Bid = null; Roleplay = null; Flood = null; CharacterCreation = null; _disposedValue = true; } }
public static void DeathVersusMonster(Fights.Fighter fighter, Engines.Map.MonsterGroup group) { var skull = Helper.ItemHelper.GenerateItem(GetSkullBreedId(fighter.Character.Breed)); }
public AddStrenghtBuff(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }
public InvisibleBuff(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }
public ChangeSkinBuff(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }
/// <summary> /// </summary> /// <param name="eventType"> </param> /// <param name="eventArgs"> </param> public void PublishTimelineEvent(TimelineEventType eventType, params object[] eventArgs) { var args = (eventArgs != null && eventArgs.Any()) ? eventArgs[0] : "(no args)"; Logging.Log(Logger, String.Format("TimelineEvent : {0} {1}", eventType, args)); if (eventArgs != null) { var monsterName = eventArgs.First() as String; switch (eventType) { case TimelineEventType.PartyJoin: case TimelineEventType.PartyDisband: case TimelineEventType.PartyLeave: break; case TimelineEventType.PartyMonsterFighting: case TimelineEventType.AllianceMonsterFighting: case TimelineEventType.OtherMonsterFighting: DeathFound = false; if (monsterName != null && (monsterName.ToLower() .Contains("target") || monsterName == "")) { break; } Fight fighting; if (!Fights.TryGet(monsterName, out fighting)) { fighting = new Fight(monsterName); Fights.Add(fighting); } Controller.Timeline.LastEngaged = monsterName; break; case TimelineEventType.PartyMonsterKilled: case TimelineEventType.AllianceMonsterKilled: case TimelineEventType.OtherMonsterKilled: DeathFound = true; if (monsterName != null && (monsterName.ToLower() .Contains("target") || monsterName == "")) { break; } Fight killed; if (!Fights.TryGet(monsterName, out killed)) { killed = new Fight(monsterName); Fights.Add(killed); } switch (eventType) { case TimelineEventType.PartyMonsterKilled: GetSetMonster(monsterName) .SetKill(killed); break; case TimelineEventType.AllianceMonsterKilled: GetSetMonster(monsterName) .SetKill(killed); break; case TimelineEventType.OtherMonsterKilled: GetSetMonster(monsterName) .SetKill(killed); break; } Controller.Timeline.LastKilled = monsterName; break; } } RaiseTimelineChangedEvent(this, new TimelineChangedEvent(eventType, eventArgs)); }
public Combat FindFight(NonPlayer npc) { return(Fights.FirstOrDefault(f => f.GetMobs().Contains(npc))); }
public void Clear() { Fights.Clear(); Bid.Clear(); CharacterCreation.Clear(); }
public void StartFight(Combat combat) { Fights.Add(combat); combat.Start(); }
public AddLuckEcaflipBuff(int duration, Fights.Fighter fighter) : base(duration, true, fighter) { }
public Combat FindFight(Player player) { return(Fights.FirstOrDefault(f => f.GetFighters().Contains(player))); }
public void RemoveFight(Fight fight) { lock (Fights) Fights.Remove(fight); }
public SubPOBuff(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }
static void Main(string[] args) { //using (var context = new Context()) //{ // var gladiator1 = context.Gladiators.Where(g => g.Id == 1).SingleOrDefault(); // var gladiator2 = context.Gladiators.Where(g => g.Id == 2).SingleOrDefault(); // Fights.Fight(gladiator1, gladiator2); // Console.ReadLine(); //} DuelsCreation.Duels(); using (var context = new Context()) { var duels = context.Duels; var round = new Round() { }; foreach (var duel in duels) { var gladiator1Id = duel.FirstGladiatorId; var gladiator2Id = duel.SecondGladiatorId; var gladiator1 = context.Gladiators.Where(g => g.Id == gladiator1Id).SingleOrDefault(); var gladiator2 = context.Gladiators.Where(g => g.Id == gladiator2Id).SingleOrDefault(); var fight = Fights.Fight(gladiator1, gladiator2); var winner = context.Gladiators.FirstOrDefault(g => g.Id == fight); Console.ReadLine(); round.AddDuel(duel, winner); } context.Rounds.Add(round); context.SaveChanges(); } DuelsCreation.Duels(); using (var context = new Context()) { var lastDuel = context.Participations.Select(p => p.DuelId).ToList(); var duelId = lastDuel.LastOrDefault(); var duels = context.Duels.Where(d => d.Id > duelId); var round = new Round() { }; foreach (var duel in duels) { var gladiator1Id = duel.FirstGladiatorId; var gladiator2Id = duel.SecondGladiatorId; var gladiator1 = context.Gladiators.Where(g => g.Id == gladiator1Id).SingleOrDefault(); var gladiator2 = context.Gladiators.Where(g => g.Id == gladiator2Id).SingleOrDefault(); var fight = Fights.Fight(gladiator1, gladiator2); var winner = context.Gladiators.FirstOrDefault(g => g.Id == fight); Console.ReadLine(); round.AddDuel(duel, winner); } context.Rounds.Add(round); context.SaveChanges(); } }
public AddCriticalBuff(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }
public void AddFight(Fights.Fight fight) { lock (Fights) Fights.Add(fight); }
public AddFixDamage(int value, int duration, Fights.Fighter fighter) : base(duration, true, fighter) { this.Value = value; }