Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 public VirtualFighter(Fight Fight, GameActorTypeEnum ActorType, Fighter Invocator = null)
     : base(Fight, ActorType, Invocator)
 {
 }
Esempio n. 4
0
        public void FighterJoin(Fighter Fighter)
        {
            Fighter.Team = this;

            this.myFighters.Add(Fighter);
        }
Esempio n. 5
0
 public void SetLeader(Fighter Fighter)
 {
     this.Leader   = Fighter;
     this.LeaderId = Fighter.ActorId;
 }
Esempio n. 6
0
 public bool IsFriendly(Fighter fighter)
 {
     return(fighter.Team.Id == this.Id);
 }
Esempio n. 7
0
 public void FighterLeave(Fighter Fighter)
 {
     this.myFighters.Remove(Fighter);
 }