Esempio n. 1
0
        public PercepteurFight(Map Map, WorldClient Player, TaxCollector Monsters) : base(FightType.TYPE_PVT, Map)
        {
            try
            {
                Logger.Debug("PVT_FIGHT Launched : Player=" + Player.GetCharacter().Name + " MapId=" + Map.Id);
                this.TaxCollector = Monsters;
                StartTimer();

                var AttFighter = new CharacterFighter(this, Player);
                var DefFighter = new PercepteurFighter(this, TaxCollector, this.NextActorId);
                TaxCollector.Map.DestroyActor(TaxCollector);
                TaxCollector.Guild.Send(new GuildFightInformationsMesssage(TaxCollector.Guild));

                foreach (var member in TaxCollector.Guild.CharactersGuildCache.Where(x => x.getPerso() != null && x.getPerso().IsOnline()))
                {
                    TaxCollector.parseAttaque(member.getPerso(), TaxCollector.GuildID);
                    TaxCollector.parseDefense(member.getPerso(), TaxCollector.GuildID);
                    member.getPerso().Send(new ChatGameMessage("Un de vos percepteurs est attaqué!", "CC0000"));
                }



                Player.AddGameAction(new GameFight(AttFighter, this));

                base.InitFight(AttFighter, DefFighter);
            }
            catch (Exception ex)
            {
                Logger.Error("PercepteurFight::PercepteurFight() " + ex.ToString());
            }
        }
Esempio n. 2
0
        public MonsterFight(Map Map, WorldClient Player, MonsterGroup Monsters)
            : base(FightType.TYPE_PVM, Map)
        {
            try
            {
                Logger.Debug("PVM_FIGHT Launched : Player=" + Player.GetCharacter().Name + " MapId=" + Map.Id);

                var AttFighter = new CharacterFighter(this, Player);
                var DefFighter = new MonsterFighter(this, Monsters.Monsters[-1], this.NextActorId, Monsters);

                this.MonsterGroup = Monsters;

                Player.AddGameAction(new GameFight(AttFighter, this));

                base.InitFight(AttFighter, DefFighter);

                bool first = true;
                foreach (var Monster in Monsters.Monsters.Values)
                {
                    if (!first)
                    {
                        base.JoinFightTeam(new MonsterFighter(this, Monster, this.NextActorId, Monsters), this.myTeam2);
                    }
                    first = false;
                }

                bool inDungeon = false;
                if (this.Map.hasEndFightAction((int)FightType))
                {
                    inDungeon = true;
                }

                int challengeNumber = (inDungeon ? 2 : 1);

                int challInitz = 0;

                while (challInitz != challengeNumber)
                {
                    var Challenge = ChallengeHandler.GetRandomChallenge(this);
                    while (!Challenge.CanSet() || Challanges.Any(x => x.Id == Challenge.Id))
                    {
                        Challenge = ChallengeHandler.GetRandomChallenge(this);
                    }
                    this.Challanges.Add(Challenge);
                    this.RegisterFightListener(Challenge);
                    challInitz++;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("MonsterFight::MonsterFight() " + ex.ToString());
            }
        }
Esempio n. 3
0
        public ChallengeFight(Map Map, WorldClient Attacker, WorldClient Defender)
            : base(FightType.TYPE_CHALLENGE, Map)
        {
            // Init du combat
            var AttFighter = new CharacterFighter(this, Attacker);
            var DefFighter = new CharacterFighter(this, Defender);

            Attacker.AddGameAction(new GameFight(AttFighter, this));
            Defender.AddGameAction(new GameFight(DefFighter, this));

            base.InitFight(AttFighter, DefFighter);
        }
Esempio n. 4
0
        public AggressionFight(Map Map, WorldClient Aggressor, WorldClient Victim)
            : base(FightType.TYPE_AGGRESSION, Map)
        {
            Logger.Debug("AGGRESSION_FIGHT Launched : Aggressor=" + Aggressor.GetCharacter().Name + " Victim=" + Victim.GetCharacter().Name + " MapId=" + Map.Id);

            // Init du combat
            var AttFighter = new CharacterFighter(this, Aggressor);
            var DefFighter = new CharacterFighter(this, Victim);

            Aggressor.AddGameAction(new GameFight(AttFighter, this));
            Victim.AddGameAction(new GameFight(DefFighter, this));

            base.InitFight(AttFighter, DefFighter);
        }
Esempio n. 5
0
        public static long CalculatePVMXp(CharacterFighter Fighter, List <Fighter> Winners, List <Fighter> Loosers, int LoosersLevel, int WinnersLevel, long GrouXp)
        {
            int    Level       = Fighter.Level;
            var    Sagesse     = Fighter.Stats.GetTotal(EffectEnum.AddSagesse);
            var    Coefficient = (Sagesse + 100) / 100;
            var    Taux        = 3;
            var    LevelMax    = Winners.Max(x => x.Level);
            double Bonus       = 0;

            foreach (var Winner in Winners)
            {
                if (Winner.Level > LevelMax / 3)
                {
                    Bonus += 1;
                }
            }

            if (Bonus == 2)
            {
                Bonus = 1.1;
            }
            else if (Bonus == 3)
            {
                Bonus = 1.3;
            }
            else if (Bonus == 4)
            {
                Bonus = 2.2;
            }
            else if (Bonus == 5)
            {
                Bonus = 2.5;
            }
            else if (Bonus == 6)
            {
                Bonus = 2.8;
            }
            else if (Bonus == 7)
            {
                Bonus = 3.1;
            }
            else if (Bonus >= 8)
            {
                Bonus = 3.5;
            }

            double Rapport = 1 + ((double)LoosersLevel / (double)WinnersLevel);

            if (Rapport <= 1.3)
            {
                Rapport = 1.3;
            }

            if (Rapport > 5)
            {
                Rapport = 5;
            }

            double Rapport2 = 1 + ((double)Level / (double)WinnersLevel);

            return((long)(GrouXp * Rapport * Bonus * Taux * Coefficient * Rapport2));
        }