Ejemplo n.º 1
0
        public override void OverridableLeaveFight(Fighter Fighter)
        {
            // Un persos quitte le combat
            switch (this.FightState)
            {
            case Fights.FightState.STATE_PLACE:     // TODO : Uniquement si kické
                this.Map.SendToMap(new GameFightTeamFlagFightersMessage(new List <Fighter> {
                    Fighter
                }, Fighter.Team.LeaderId, false));

                this.SendToFight(new GameActorDestroyMessage(Fighter.ActorId));

                Fighter.LeaveFight();

                Fighter.Send(new GameLeaveMessage());
                if (Team1.GetAliveFighters().Count == 0 || Team2.GetAliveFighters().Count == 0)
                {
                    FightTeam ft = null;
                    if (Team1.GetAliveFighters().Count == 0)
                    {
                        ft = Team1;
                    }
                    else
                    {
                        ft = Team2;
                    }

                    foreach (var TeamFighter in ft.GetFighters())
                    {
                        TeamFighter.Life = 0;
                    }

                    Fighter.Left = true;

                    this.OverridableEndFight(this.GetEnnemyTeam(ft), ft);
                }
                break;

            case FightState.STATE_ACTIVE:
                if (Fighter.TryDie(Fighter.ActorId, true) != -3)
                {
                    Fighter.LeaveFight();

                    Fighter.Send(new GameLeaveMessage());
                }
                ;
                break;
            }
        }
Ejemplo n.º 2
0
        public override void OverridableEndFight(FightTeam Winners, FightTeam Loosers)
        {
            var WinnersFighter = Winners.GetFighters().OfType <CharacterFighter>().ToList();
            var LoosersFighter = Loosers.GetFighters().OfType <CharacterFighter>().ToList();

            var WinnersTotalCote = WinnersFighter.Sum(x => x.Character.Cote);
            var LoosersTotalCote = LoosersFighter.Sum(x => x.Character.Cote);

            int WinCote = 0, LooseCote = 0;

            if (LoosersTotalCote - WinnersTotalCote < 0)
            {
                WinCote = 25;
            }
            else if (WinnersTotalCote - LoosersTotalCote < 0)
            {
                WinCote = 75;
            }
            else
            {
                WinCote = 50;
            }

            if (LoosersTotalCote - WinnersTotalCote < 0)
            {
                LooseCote = 25;
            }
            else if (WinnersTotalCote - LoosersTotalCote < 0)
            {
                LooseCote = 75;
            }
            else
            {
                LooseCote = 50;
            }



            var PossibleItemLoot = new List <ItemLoot>();
            var ItemDroped       = new Dictionary <int, int>()
            {
                { Settings.AppSettings.GetIntElement("Kolizeum.WinItem"), 3 },
            };

            foreach (var Fighter in LoosersFighter)
            {
                int CoteLoosed = LooseCote;

                if (!Fighter.Left)
                {
                    if (Fighter.Character.Cote - LooseCote < 0)
                    {
                        CoteLoosed = Fighter.Character.Cote;
                    }
                    Fighter.Character.Cote -= CoteLoosed;
                }

                this.myResult.AddResult(Fighter, false, WinExp: -CoteLoosed);
            }

            foreach (var Fighter in WinnersFighter)
            {
                if (!Fighter.Left)
                {
                    Fighter.Character.Cote += WinCote;
                    this.myResult.AddResult(Fighter, true, WinExp: WinCote, WinItems: ItemDroped);
                    InventoryItemTable.TryCreateItem(ItemDroped.First().Key, Fighter.Character, ItemDroped.First().Value);
                }
                else
                {
                    this.myResult.AddResult(Fighter, true);
                }
            }
            base.EndFight();
        }
Ejemplo n.º 3
0
        public override void OverridableEndFight(FightTeam Winners, FightTeam Loosers)
        {
            var WinnersFighter  = Winners.GetFighters().OfType <CharacterFighter>().ToList();
            var LoosersFighter  = Loosers.GetFighters().OfType <CharacterFighter>().ToList();
            var WinnersFighterP = Winners.GetFighters().OfType <PrismFighter>().ToList();
            var LoosersFighterP = Loosers.GetFighters().OfType <PrismFighter>().ToList();

            var WinnersTotalGrade = WinnersFighter.Sum(x => x.Character.getGrade());
            var WinnersTotalLevel = WinnersFighter.Sum(x => x.Level);

            WinnersTotalGrade += WinnersFighterP.Sum(x => x.Prisme.Level * 15 + 80);//Setting LEVEL PVP
            WinnersTotalLevel += WinnersFighterP.Sum(x => x.Level);

            var LoosersTotalGrade = LoosersFighter.Sum(x => x.Character.getGrade());
            var LoosersTotalLevel = LoosersFighter.Sum(x => x.Level);

            LoosersTotalGrade += LoosersFighterP.Sum(x => x.Prisme.Level * 15 + 80);
            LoosersTotalLevel += LoosersFighterP.Sum(x => x.Level);

            foreach (var Fighter in LoosersFighter)
            {
                int WinHonor = 0;
                if (Fighter.Character.AlignmentType != AlignmentTypeEnum.ALIGNMENT_NEUTRAL)
                {
                    WinHonor = Algo.CalculateAggressionHonor(Fighter, false, WinnersFighter.Count + WinnersFighterP.Count, WinnersTotalGrade, WinnersTotalLevel, LoosersTotalGrade, LoosersTotalLevel);
                    if (WinHonor > Fighter.Character.Honor)
                    {
                        WinHonor = Fighter.Character.Honor;
                    }
                    Fighter.Character.RemoveHonor(WinHonor);
                }


                if (Fighter.Character.GetClient() != null)
                {
                    Fighter.Character.GetClient().Send(new AccountStatsMessage(Fighter.Character));
                }


                this.myResult.AddResult(Fighter, false, WinHonor: -WinHonor);
            }

            var PhToWin = Algo.Random(150, 300);

            foreach (var Fighter in WinnersFighter)
            {
                var Drops = new Dictionary <int, int>();

                if (Fighter.Character.AlignmentType != AlignmentTypeEnum.ALIGNMENT_NEUTRAL)
                {
                    Fighter.Character.AddHonor(PhToWin);
                }

                this.myResult.AddResult(Fighter, true, WinHonor: PhToWin, WinItems: Drops);
            }

            foreach (var Fighter in LoosersFighterP)
            {
                int WinHonor = PhToWin;

                if (WinHonor > Fighter.Prisme.Honor)
                {
                    WinHonor = Fighter.Prisme.Honor;
                }
                Fighter.Prisme.AddHonor(-WinHonor);

                Network.WorldServer.GetChatController().getAlignementChannel(AlignmentTypeEnum.ALIGNMENT_NEUTRAL).Send(new SubAreaAlignMessage(Map.subArea.ID + "|0|1"));
                Network.WorldServer.GetChatController().getAlignementChannel((AlignmentTypeEnum)Prisme.Alignement).Send(new ConquestPrismDiedMessage(Prisme.Mapid + "|" + Prisme.Map.X + "|" + Prisme.Map.Y));

                foreach (var Key in Network.WorldServer.GetChatController().AlignChannels.Keys.Where(x => x != AlignmentTypeEnum.ALIGNMENT_NEUTRAL))
                {
                    Network.WorldServer.GetChatController().getAlignementChannel(Key).Send(new SubAreaAlignMessage(Map.subArea.ID + "|-1|0"));
                    Network.WorldServer.GetChatController().getAlignementChannel(Key).Send(new SubAreaAlignMessage(Map.subArea.ID + "|0|1"));
                    if (Prisme.Area == -1)
                    {
                        continue;
                    }
                    Network.WorldServer.GetChatController().getAlignementChannel(Key).Send(new AreaAlignMessage(Map.subArea.areaID + "|-1"));
                }
                if (Prisme.Area != -1)
                {
                    Map.subArea.area.Prisme = 0;
                    Map.subArea.area.setAlignement(0);
                }

                Map.subArea.Prisme = 0;
                Map.subArea.setAlignement(0);
                this.Map.DestroyActor((Fighter as PrismFighter).Prisme);
                PrismeTable.TryDeleteTax((Fighter as PrismFighter).Prisme);

                this.myResult.AddResult(Fighter, false, WinHonor: -WinHonor);
            }
            foreach (var Fighter in WinnersFighterP)
            {
                int WinHonor = Algo.CalculateAggressionHonor(Fighter, true, WinnersFighter.Count + WinnersFighterP.Count, WinnersTotalGrade, WinnersTotalLevel, LoosersTotalGrade, LoosersTotalLevel);
                Fighter.Prisme.AddHonor(WinHonor);
                Network.WorldServer.GetChatController().getAlignementChannel((AlignmentTypeEnum)Prisme.Alignement).Send(new ConquestPrismSurvivedMessage(Prisme.Mapid + "|" + Prisme.Map.X + "|" + Prisme.Map.Y));
                Prisme.inFight      = -1;
                Prisme.CurrentFight = null;
                Prisme.Map.SpawnActor((Fighter as PrismFighter).Prisme);
                var Drops = new Dictionary <int, int>();
                this.myResult.AddResult(Fighter, true, WinHonor: WinHonor, WinItems: Drops);
            }
            base.EndFight();
        }