public int TryDie(long CasterId, bool force = false) { if (force) { this.Life = 0; } if (this.Life <= 0) { if (!haveSendKillingMessage)//TODO mat affichich quand le double meurt alors que l'invoqueur a abondonné { this.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_KILLFIGHTER, CasterId, this.ActorId.ToString())); haveSendKillingMessage = true; } if (this.InvokTotal > 0) { this.Team.GetAliveFighters().Where(x => x.Invocator != null && x.Invocator.ActorId == this.ActorId).ToList().ForEach(Fighter => Fighter.TryDie(this.ActorId, true)); } System.Threading.Thread.Sleep(500); this.Fight.onFighterDie(this, this.Fight.GetFighter(CasterId)); if (this.Fight.TryEndFight()) { return(-3); } if (this.Fight.CurrentFighter == this) { this.Fight.FightLoopState = FightLoopState.STATE_END_TURN; } /*foreach (var item in this.Fight.getGlyphe().Where(x => x.Caster.ActorId == this.ActorId)) * { * this.Fight.SendToFight(new FightGlypheMessage("-", item.CellId, item.Size, 4)); * this.Fight.SendToFight(new FightGlypheCanceledMessage(item.CellId)); * this.Fight.removeGlyphe(item); * } * * foreach (var item in this.Fight.getTraps().Where(x => x.Caster.ActorId == this.ActorId)) * { * item.desappear(); * this.Fight.removeTrap(item); * }*/ return(-2); } return(-1); }
/// <summary> /// Calcul des PA/PM perdus /// </summary> /// <param name="Caster"></param> /// <param name="LostPoint"></param> /// <param name="MP"></param> /// <returns></returns> public int CalculDodgeAPMP(Fighter Caster, int LostPoint, bool MP = false) { var RealLostPoint = 0; if (!MP) { var DodgeAPCaster = Caster.APDodge + 1; var DodgeAPTarget = this.APDodge + 1; for (int i = 0; i < LostPoint; i++) { var ActualAP = this.AP - RealLostPoint; var PercentLastAP = ActualAP / this.AP; var Chance = 0.5 * (DodgeAPCaster / DodgeAPTarget) * PercentLastAP; var PercentChance = Chance * 100; if (PercentChance > 100) { PercentChance = 90; } if (PercentChance < 10) { PercentChance = 10; } if (Random.Next(0, 99) < PercentChance) { RealLostPoint++; } } } else { var DodgeMPCaster = Caster.MPDodge; var DodgeMPTarget = this.MPDodge; for (int i = 0; i < LostPoint; i++) { var ActualMP = this.MP - RealLostPoint; var PercentLastMP = ActualMP / this.MP; var Chance = 0.5 * (DodgeMPCaster / DodgeMPTarget) * PercentLastMP; var PercentChance = Chance * 100; if (PercentChance > 100) { PercentChance = 90; } if (PercentChance < 10) { PercentChance = 10; } if (Random.Next(0, 99) < PercentChance) { RealLostPoint++; } } } return(RealLostPoint); }
public VirtualFighter(Fight Fight, GameActorTypeEnum ActorType, Fighter Invocator = null) : base(Fight, ActorType, Invocator) { }
public void FighterJoin(Fighter Fighter) { Fighter.Team = this; this.myFighters.Add(Fighter); }
public void SetLeader(Fighter Fighter) { this.Leader = Fighter; this.LeaderId = Fighter.ActorId; }
public bool IsFriendly(Fighter fighter) { return(fighter.Team.Id == this.Id); }
public void FighterLeave(Fighter Fighter) { this.myFighters.Remove(Fighter); }