public void RemoveFight(Fight.Fight fight) { lock (locker) { this.Fights.Remove(fight); foreach (var client in this.ClientsOnMap) { client.SendPacket(new MapFightCountMessage((uint)this.Fights.Count)); } } }
public UserFighterController(User user, Fight.Fight fight, int knifeIndex) { _user = user ?? throw new ArgumentNullException(nameof(user)); _fight = fight ?? throw new ArgumentNullException(nameof(fight)); _knifeIndex = knifeIndex; _fight.Win += Fight_Win_Handler; _fight.FightStart += Fight_FightStart_Handler; _fight.DeatHead += Fight_DeatHead_Handler; _fight.KnifeThrow += Kight_KnifeThrow_Handler; _user.MsgReaders.RegisterMsgReader <ThrowKnifeMessage>(UserThroKnife_Reader); _user.MsgReaders.RegisterMsgReader <ReadyToFightMessage>(UserReadyToFight_Reader); }
public List <Fighter> GetFightersHitFromTargetMask(Fight.Fight fight, List <uint> cells, Fighter caster, uint cellId, EffectInstanceDice effect) { var fighters = new List <Fighter>(); foreach (var targetMask in effect.TargetMask) { switch ((TargetMaskEnum)targetMask) { case TargetMaskEnum.a: fighters.AddRange(fight.Fighters.Where(x => x.Life > 0 && x.Team == caster.Team && cells.Contains((uint)x.CellId))); break; case TargetMaskEnum.A: fighters.AddRange(fight.Fighters.Where(x => x.Life > 0 && x.Team != caster.Team && cells.Contains((uint)x.CellId))); break; case TargetMaskEnum.g: fighters.AddRange(fight.Fighters.Where(x => x.Life > 0 && x.Team == caster.Team && x != caster && cells.Contains((uint)x.CellId))); break; case TargetMaskEnum.c: if (cells.Contains((uint)caster.CellId)) { fighters.Add(caster); } break; case TargetMaskEnum.C: fighters.Add(caster); break; case TargetMaskEnum.D: case TargetMaskEnum.H: case TargetMaskEnum.J: case TargetMaskEnum.l: case TargetMaskEnum.M: case TargetMaskEnum.m: case TargetMaskEnum.j: case TargetMaskEnum.L: case TargetMaskEnum.P: break; default: break; } } return(fighters); }
public void AddFight(WorldClient client, Fight.Fight fight) { lock (locker) { this.Fights.Add(fight); foreach (var otherClient in this.ClientsOnMap.FindAll(x => x.ActiveCharacter.Id != client.ActiveCharacter.Id)) { //?? otherClient.SendPacket(new GameFightOptionStateUpdateMessage((uint)fight.Id, 0, 0, true)); otherClient.SendPacket(new GameFightOptionStateUpdateMessage((uint)fight.Id, 1, 0, true)); otherClient.SendPacket(new GameFightOptionStateUpdateMessage((uint)fight.Id, 0, 1, true)); otherClient.SendPacket(new GameRolePlayShowChallengeMessage(fight.GetFightCommonInformations())); otherClient.SendPacket(new MapFightCountMessage((uint)this.Fights.Count)); } } }
void Fight_FightStart_Handler(Fight.Fight obj) { var startFightMessage = new StartFightMessage(); _user.SendMsg(startFightMessage); }
//---handlers private void Fight_DeatHead_Handler(Fight.Fight obj) { _user.SendMsg(new EndFightMessage(-1)); }
public IFighterController CreateFighterController(Fight.Fight fight, int kifeIndexInFight) { return(new UserFighterController(_user, fight, kifeIndexInFight)); }