Пример #1
0
        public static List <Effects.ZoneEffect.ZoneEffectTemplate> affected(object[] parameters)
        {
            /// Glyphe / losange  / rhombus
            ///                 [ ]
            ///              [ ][ ][ ]
            ///           [ ][ ][ ][ ][ ]
            ///        [ ][ ][ ][x][ ][ ][ ]
            ///           [ ][ ][ ][ ][ ]
            ///              [ ][ ][ ]
            ///                 [ ]
            ///
            Battle _battle  = parameters[0] as Battle;
            Point  spellPos = parameters[1] as Point;

            mysql.spells spell_template = parameters[2] as mysql.spells;
            Actor        spellCaster    = parameters[3] as Actor;

            // liste qui contiens tous les joueurs dans la zone d'effet
            List <ZoneEffectTemplate> l = new List <ZoneEffectTemplate>();

            // joueur dans la case centrale
            Actor pi = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X && f.map_position.Y == spellPos.Y);

            if (pi != null)
            {
                ZoneEffectTemplate centralT = new ZoneEffectTemplate();
                centralT.AffectedActor = pi;
                centralT.Pertinance    = 100;
                l.Add(centralT);

                // algo pour trouver tout les adversaire dans la glyph
                for (int vertical = 0; vertical < spell_template.sizeEffect; vertical++)
                {
                    for (int horizontal = 0; horizontal < spell_template.sizeEffect; horizontal++)
                    {
                        if (vertical == 0 && horizontal == 0)
                        {
                            continue;
                        }

                        // tuile à droite du centre
                        Actor rightPlayer = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X + horizontal && f.map_position.Y == spellPos.Y + vertical);
                        Effects.ZoneEffect.ZoneEffectTemplate rightT = new ZoneEffectTemplate();
                        rightT.AffectedActor = rightPlayer;
                        rightT.Pertinance    = 100 - ((vertical * 10) / 100) - ((horizontal * 10) / 100);
                        l.Add(rightT);

                        // tuile à gauche du centre
                        Actor leftPlayer = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X - horizontal && f.map_position.Y == spellPos.Y - vertical);
                        Effects.ZoneEffect.ZoneEffectTemplate leftT = new ZoneEffectTemplate();
                        leftT.AffectedActor = leftPlayer;
                        leftT.Pertinance    = 100 - ((vertical * 10) / 100) - ((horizontal * 10) / 100);
                        l.Add(leftT);
                    }
                }
            }

            return(l);
        }
Пример #2
0
        public static string Apply(object[] parameters)
        {
            Actor actor = (Actor)parameters[0];

            Effects.ZoneEffect.ZoneEffectTemplate affected = (Effects.ZoneEffect.ZoneEffectTemplate)parameters[1];
            //Actor sacrifiedSummon = parameters[2] as Actor;
            string criteria = (string)parameters[3];

            mysql.spells  spell  = (mysql.spells)parameters[4];
            Actor.effects effect = (Actor.effects)parameters[5];
            bool          cd     = (bool)parameters[6];

            ///////////////////////////////////////////////////////////

            //Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            Misc.Criteria.Handlers.Icriteria ci = Misc.Criteria.Handlers.translation.translate(criteria);
            object[] parameters1 = new object[1];
            parameters1[0] = criteria;
            int value = Convert.ToInt32(ci.Apply(parameters1));

            // un evenement dois être créer pour gérer tous seul si le max pdv a été franchie grace au variable d'accessibilité get, set
            affected.AffectedActor.originalPm += value;
            affected.AffectedActor.currentPm  += value;
            string buffer = affected.AffectedActor.Pseudo + ":" + value + ":" + affected.AffectedActor.originalPm + ":pm";

            //// ajout du sort dans la liste des envoutements visibles pour les joueurs concernés
            if (actor.BuffsList.Exists(f => f.SortID == spell.spellID && !f.system))
            {
                // sort trouvé
                Actor.Buff piEnv = actor.BuffsList.Find(f => f.SortID == spell.spellID && !f.system);
                piEnv.playerRoxed.Add("null");
            }
            else
            {
                // ajout du sort dans les envoutements
                Actor.Buff piEnv1 = new Actor.Buff
                {
                    SortID           = spell.spellID,
                    title            = spell.spellName,
                    Debuffable       = true,
                    VisibleToPlayers = true,
                    relanceInterval  = spell.relanceInterval,
                    BuffState        = Enums.Buff.State.Fin,
                    relanceParTour   = spell.relanceParTour,
                    system           = false,
                    Duration         = effect.duration,
                    Cd     = cd,
                    Player = actor.Pseudo
                };
                piEnv1.playerRoxed.Add("null");
                piEnv1.Bonus.originalPm = value;
                actor.BuffsList.Add(piEnv1);
            }

            return(buffer);
        }
Пример #3
0
        // decodage de la chaine des effets
        // effect base # effect id # target(separed by / if many) # element # duraion # delay # zoneSize # zoneExtensible # handToHandDistance # min # max # flag1 # flag2 # flag3 | (separator between effects)
        public static List <Actor.effects> effects_decoder(int spellID, int level)
        {
            mysql.spells         info_sort  = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == level);
            List <Actor.effects> Alleffects = new List <Actor.effects>();

            if (info_sort.extraDataEffect == null || info_sort.extraDataEffect == "")
            {
                return(Alleffects);
            }

            int cnt = info_sort.extraDataEffect.Split('|').Length;

            for (int c = 0; c < cnt; c++)
            {
                Actor.effects effect      = new Actor.effects();
                string[]      effect_data = info_sort.extraDataEffect.Split('|')[c].Split('#');

                Enums.Effect.effects_base effect_base;
                Enum.TryParse(effect_data[0], out effect_base);

                effect.base_effect = effect_base;

                effect.effect_id = Convert.ToInt32(effect_data[1]);
                string[] targets_data = effect_data[2].Split('/');
                for (int c2 = 0; c2 < targets_data.Length; c2++)
                {
                    Enums.spell_effect_target.targets target;
                    Enum.TryParse(targets_data[c2], out target);
                    effect.targets.Add(target);
                }
                Enums.Chakra.Element element;
                Enum.TryParse(effect_data[3], out element);

                effect.duration           = Convert.ToInt32(effect_data[4]);
                effect.delay              = Convert.ToInt32(effect_data[5]);
                effect.zoneSize           = Convert.ToInt32(effect_data[6]);
                effect.zoneExtensible     = Convert.ToBoolean(effect_data[7]);
                effect.handToHandDistance = Convert.ToInt32(effect_data[8]);
                effect.min   = Convert.ToInt32(effect_data[9]);
                effect.max   = Convert.ToInt32(effect_data[10]);
                effect.flag1 = effect_data[11];
                effect.flag2 = effect_data[12];
                effect.flag3 = effect_data[13];

                Alleffects.Add(effect);
            }

            return(Alleffects);
        }
Пример #4
0
        // contrôles auxiliaires specifique à l'effet en cours
        public static bool Apply(object[] parameters)
        {
            // params = im, spellPos, spellID
            NetIncomingMessage im = parameters[0] as NetIncomingMessage;
            Point spellPos        = parameters[1] as Point;
            int   spellID         = (int)parameters[2];

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == (im.SenderConnection.Tag as Actor).idBattle);
            Actor  pi      = _battle.AllPlayersByOrder.Find(f => f.Pseudo == (im.SenderConnection.Tag as Actor).Pseudo);

            Actor.SpellsInformations spell_player_state = (im.SenderConnection.Tag as Actor).sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_template     = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == spell_player_state.Level);

            Point playerPos      = pi.map_position;
            Actor playerTargeted = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X && f.map_position.Y == spellPos.Y);

            #region check si la case centrale est bien une invocation avec les critères demandés
            // il faut que le sort sois lancé sur l'une des invocations du joueur en cours
            // on cherche si le joueur a une invocation sur le terrain
            Actor piInvoked = _battle.AllPlayersByOrder.Find(f => f.Pseudo.IndexOf("$") != -1 && f.Pseudo.Substring(0, f.Pseudo.IndexOf("$")) == pi.Pseudo && f.map_position.X == spellPos.X && f.map_position.Y == spellPos.Y);
            if (piInvoked == null)
            {
                return(false);
            }

            // check si l'idForSummon est bien celui du flag1
            // on cherche parmis les effet celui du killSummonToBoost pour soustraire le flag1
            Actor.effects effect = spell_player_state.effect.Find(f => f.base_effect.ToString() == "killSummonToBoost");
            if (effect != null)
            {
                int idForSummon = 0;
                if (!int.TryParse(effect.flag1, out idForSummon))
                {
                    return(false);
                }

                if (piInvoked.summonID != idForSummon)
                {
                    return(false);
                }
            }
            #endregion

            return(true);
        }
Пример #5
0
        private void filter_Click(object sender, EventArgs e)
        {
            if (!int.TryParse(SpellID.Text, out _spellID))
            {
                MessageBox.Show("Veuillez entrez une valeur numérique supérieur ou égale à 0 pour le champ SpellID");
                SpellID.Focus();
                return;
            }

            if (!int.TryParse(Level.Text, out _level))
            {
                MessageBox.Show("Veuillez entrez une valeur numérique supérieur ou égale à 0 pour le champ Level");
                Level.Focus();
                return;
            }

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == _spellID && f.level == _level);

            if (spell.target != null)
            {
                string[] filter = spell.target.Split('#');
                spellTargetCB.Items.AddRange(filter);

                targetList.Items.AddRange("self#enemy_1#ally_1#none#ally_summon#enemy_summon#ally_all#enemy_all".Split('#'));
                foreach (string s in spellTargetCB.Items)
                {
                    targetList.Items.Remove(s);
                }

                if (spellTargetCB.Items.Count > 0)
                {
                    spellTargetCB.SelectedIndex = 0;
                }

                if (targetList.Items.Count > 0)
                {
                    targetList.SelectedIndex = 0;
                }
            }
            else
            {
                MessageBox.Show("No target found for this spell");
                targetList.Items.AddRange("self#enemy_1#ally_1#none#ally_summon#enemy_summon#ally_all#enemy_all".Split('#'));
            }
        }
Пример #6
0
        // sort 01 de la classe Naruto
        // contôle specifique au sort
        public static bool spellChecker(object[] parameters)
        {
            int   spellID         = 0;
            Actor pi              = parameters[0] as Actor;
            Point spellPos        = parameters[1] as Point;
            NetIncomingMessage im = parameters[2] as NetIncomingMessage;

            Actor.SpellsInformations infos_sorts = (im.SenderConnection.Tag as Actor).sorts.Find(f => f.SpellId == spellID);
            Battle _battle        = Battle.Battles.Find(f => f.IdBattle == (im.SenderConnection.Tag as Actor).idBattle);
            Point  playerPos      = pi.map_position;
            Actor  playerTargeted = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X && f.map_position.Y == spellPos.Y);

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).FindLast(f => f.level == infos_sorts.Level);

            int porte = Math.Abs(playerPos.Y - spellPos.Y);

            return(true);
        }
Пример #7
0
        public static string Apply(object[] parameters)
        {
            // flag 1 = id de la classe qui se trouve dans la table Classes afin de soustraire les caractèristique de l'invocation
            // flag 2 = caracteristique a booster
            // flag 3 = valeur
            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID);
            //NetConnection nim = MainClass.netServer.Connections.Find(f => f.Tag != null && (f.Tag as PlayerInfo).Pseudo == spellCaster.Pseudo);

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            ////////////////////////////////////////////////////////////////////////
            Enums.Buff.Name pState = (Enums.Buff.Name)Enum.Parse(typeof(Enums.Buff.Name), effect.flag1);

            //string DotonString = ""
            foreach (ZoneEffect.ZoneEffectTemplate affected in affectedPlayers)
            {
                affected.AffectedActor.BuffState.Add(pState);

                // on augemente la puissance des personnages dans la zone
                //spellCaster.doton += sorts.sort(sortID).isbl[spellLvl - 1].piBonus.doton;
                //DotonString += spellCaster.Pseudo + ":" + sorts.sort(sortID).isbl[spellLvl - 1].piBonus.doton + ":" + pi.doton;

                //string dom = "typeRox:etat:sinnin|cd:" + cdAllowed + "|chakra:neutre|deadList:" + playerDead + "|" + DotonString;
            }


            string buffer = "typeRox:etat:sinnin|cd:" + cd + "|chakra:neutre|deadList:|";

            return(buffer);
        }
Пример #8
0
        public static void Apply(object[] parameters)
        {
            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            //// ajout du sort dans la liste des envoutements systeme
            if (spellCaster.BuffsList.Exists(f => f.SortID == spellID && f.system))
            {
                // sort trouvé
                Actor.Buff piEnv = spellCaster.BuffsList.Find(f => f.SortID == spellID && f.system);
                piEnv.playerRoxed.Add("null");
            }
            else
            {
                // ajout du sort dans les envoutements
                Actor.Buff piEnv1 = new Actor.Buff();
                piEnv1.SortID           = spellID;
                piEnv1.title            = spell_Template.spellName;
                piEnv1.Debuffable       = false;
                piEnv1.VisibleToPlayers = false;
                piEnv1.playerRoxed.Add("null");         // pas la paine d'ajouter le nom d'un adversaire vus que le sort tap en zone, et na pas l'option relanceParJoueur
                piEnv1.relanceInterval = spell_Template.relanceInterval;
                piEnv1.BuffState       = Enums.Buff.State.Fin;
                piEnv1.relanceParTour  = spell_Template.relanceParTour;
                piEnv1.system          = true;
                piEnv1.Cd     = cd;
                piEnv1.Player = spellCaster.Pseudo;
                spellCaster.BuffsList.Add(piEnv1);
            }
        }
Пример #9
0
 public static string is_Spell_Allowed_From_Current_Pos(Battle _battle, Actor playerTargeted, Actor pi, int spellID)
 {
     // on vérifie selon le sort, si c'est un cac ou à distance
     if (spellID == 4)
     {
         // sort qui se lance au cac
         // on vérifie si l'adversaire en question est au cac, si non on vérifie si on peux l'atteindre
         if (((pi.map_position.X == playerTargeted.map_position.X + 1 || pi.map_position.X == playerTargeted.map_position.X - 1) && pi.map_position.Y == playerTargeted.map_position.Y) || ((pi.map_position.Y == playerTargeted.map_position.Y + 1 || pi.map_position.Y == playerTargeted.map_position.Y - 1) && (pi.map_position.X == playerTargeted.map_position.X)))
         {
             // on vérifie si le sort en question peux etre lancé avec les envoutement
             if (pi.BuffsList.Exists(f => f.SortID == spellID && f.system))
             {
                 Actor.Buff piEnv = pi.BuffsList.Find(f => f.SortID == spellID && f.system);
                 Actor.SpellsInformations piis  = pi.sorts.Find(f => f.SpellId == spellID);
                 mysql.spells             spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == piis.Level - 1);
                 if (piEnv.relanceInterval < spell.relanceInterval)
                 {
                     // check contre relanceInterval si il a déja été lance dans un tours précédent, d'où le relanceInterval ne dois pas égale celui attribué la 1er fois, pour laisser le joueur lancer le sort plusieurs fois le tour actuel
                     return("spellIntervalNotReached");
                 }
                 else if (spell.relanceParTour > 0 /*&& playerTargeted != null*/ && piEnv.playerRoxed.Count >= spell.relanceParTour)
                 {
                     // check contre le max de ralance par tour "relanceParTour", si = 0 donc ilimité
                     return("spellRelanceParTourReached");
                 }
                 else if (spell.relanceParJoueur > 0 && playerTargeted != null && piEnv.playerRoxed.FindAll(f => f == playerTargeted.Pseudo).Count >= spell.relanceParJoueur)
                 {
                     // check contre relanceParJoueur s'il a déja été lancé sur le même adversaire, si = 0 donc illimité
                     return("spellRelanceParJoueurReached");
                 }
             }
             return("allowed");
         }
         else
         {
             return("denied");
         }
     }
     return("denied");
 }
Пример #10
0
        public static void Apply(Actor spellCaster, Battle _battle, Point spellPos, int spellID)
        {
            NetConnection nim = MainClass.netServer.Connections.Find(f => f.Tag != null && (f.Tag as Actor).Pseudo == spellCaster.Pseudo);

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);

            #region ZoneEffect qui permet la recherche de tous les joueurs prises dans l'effet selon la zone d'effet
            Type typeZoneEffect = Type.GetType("SERVER.Effects.ZoneEffect." + spell_Template.zoneEffect);
            System.Reflection.MethodInfo zoneEffect = typeZoneEffect.GetMethod("affected");

            object[] parameters = new object[4];
            parameters[0] = _battle;
            parameters[1] = spellPos;
            parameters[2] = spell_Template;
            parameters[3] = spellCaster;

            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers;

            if (zoneEffect != null)
            {
                affectedPlayers = zoneEffect.Invoke(null, new object[] { parameters }) as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            }
            else
            {
                affectedPlayers = new List <Effects.ZoneEffect.ZoneEffectTemplate>();
            }
            #endregion

            string buffer = "";

            #region CD
            int cdRequird = spell_Template.cd;
            int cdBonnus  = spell_Template.cdDomBonnus;
            int cdLeft    = cdRequird - spellCaster.cd;
            if (cdLeft <= 0)
            {
                cdLeft = 1;
            }

            Random rnd = new Random();

            // mise en 1/2 si le nombre cd est inférieur ou égale à 1
            bool cd = false;
            if (cdLeft <= 1)
            {
                cdLeft = 1;
            }

            // tentative de cd
            int rndCD = rnd.Next(0, cdLeft + 1);
            if (rndCD == 0)
            {
                cd = true;
            }

            #endregion

            #region balayage sur tout les effet (check target type et execution du handler du sort)
            foreach (Actor.effects current_effect in infos_sorts.effect)
            {
                #region check target type
                Actor centralFocus = _battle.AllPlayersByOrder.Find(f => f.map_position.X == spellPos.X && f.map_position.Y == spellPos.Y);
                Enums.spell_effect_target.targets target = CommonCode.TargetParser(spellCaster, centralFocus);
                if (!current_effect.targets.Exists(f => f == target))
                {
                    CommonCode.SendMessage("cmd•spellTargetNotAllowed", nim, true);
                    break;
                }
                #endregion

                #region buffer
                int minDice = current_effect.min;
                int maxDice = current_effect.max;

                Type t2 = Type.GetType("SERVER.Effects.Handlers." + current_effect.base_effect);
                if (t2 == null)
                {
                    Console.WriteLine("le handler pour SERVER.Effecrs.Handlers." + current_effect.base_effect + " n'existe pas");
                    return;
                }
                System.Reflection.MethodInfo TypeEffect = t2.GetMethod("Apply");

                object[] parameters2 = new object[6];
                parameters2[0] = spellCaster;
                parameters2[1] = affectedPlayers;
                parameters2[2] = spellID;
                parameters2[3] = current_effect;
                parameters2[4] = cd;
                parameters2[5] = spellPos;

                if (TypeEffect != null)
                {
                    buffer += (string)TypeEffect.Invoke(null, new object[] { parameters2 }) + "#";
                }

                if (buffer != "")
                {
                    buffer = buffer.Substring(0, buffer.Length - 1);
                }
                #endregion
            }
            #endregion

            #region inscription dans les envoutements
            foreach (Actor.effects current_effect in infos_sorts.effect)
            {
                Type buffHandler = Type.GetType("SERVER.Buff." + current_effect.base_effect);
                if (buffHandler != null)
                {
                    System.Reflection.MethodInfo buffHandlerApply = buffHandler.GetMethod("Apply");

                    object[] parameters2 = new object[6];
                    parameters2[0] = spellCaster;
                    parameters2[1] = affectedPlayers;
                    parameters2[2] = spellID;
                    parameters2[3] = current_effect;
                    parameters2[4] = cd;
                    parameters2[5] = spellPos;

                    if (buffHandlerApply != null)
                    {
                        buffHandlerApply.Invoke(null, new object[] { parameters2 });
                    }
                }
                else
                {
                }
            }
            #endregion

            #region diminution des pc
            spellCaster.currentPc -= spell_Template.pc;
            #endregion

            #region envoie de la command à tous les joueurs
            List <Actor> humans_in_battle = _battle.AllPlayersByOrder.FindAll(f => f.species == Species.Name.Human);

            // envoie d'une cmd a tous les abonnés au combats
            for (int cnt2 = 0; cnt2 < humans_in_battle.Count; cnt2++)
            {
                // envoie d'une requette a tous les personnages
                NetConnection humainNim = MainClass.netServer.Connections.Find(f => f.Tag != null && (f.Tag as Actor).Pseudo == humans_in_battle[cnt2].Pseudo);
                if (nim != null && humainNim != null)
                {
                    CommonCode.SendMessage("cmd•spellTileGranted•" + spellCaster.Pseudo + "•" + spellID + "•" + spellPos.X + "•" + spellPos.Y + "•" + infos_sorts.SpellColor + "•" + infos_sorts.Level + "•" + buffer + "•PcUsed:" + spell_Template.pc, humainNim, true);
                    Console.WriteLine("<--cmd•spellTileGranted•" + spellCaster.Pseudo + "•" + spellID + "•" + spellPos.X + "•" + spellPos.Y + "•" + infos_sorts.SpellColor + "•" + infos_sorts.Level + "•" + buffer + "•PcUsed:" + spell_Template.pc + " to " + (humainNim.Tag as Actor).Pseudo);
                }
            }
            #endregion
            //////////////////////////////////////////////////////////////////////////////////

            ///////////////////// cloture du combat s'il n y a personne
            if (buffer != "")
            {
                for (int cnt2 = 0; cnt2 < buffer.Split('#').Length; cnt2++)
                {
                    string dom2 = buffer.Split('#')[cnt2];
                    if (dom2.Split('|')[0] == "typeRox:rox")
                    {
                        string deadPlayer = dom2.Split('|')[5].Split(':')[1];
                        if (deadPlayer != "")
                        {
                            // supprimer le joueur de la liste des joueurs actifs
                            // check si le combat est terminé
                            Actor _playerTargeted = _battle.DeadPlayers.Find(f => f.Pseudo == deadPlayer);
                            if (CommonCode.IsClosedBattle(_battle, _playerTargeted))
                            {
                                _battle.State = Enums.battleState.state.closed;
                            }
                            else
                            {
                                Console.WriteLine("nothing !!!");
                            }
                        }
                    }
                }
            }
            ///////////////////////////////////////////////////////////////
        }
Пример #11
0
        public static Actor Apply(Actor spellCaster, mysql.summon summon, mysql.spells spell_Template, Actor.effects effect)
        {
            // si la classe PlayerInfo est modifié comme l'ajout d'un nouveau champ, il faut ajouter son attribution ici
            Actor pi = new Actor();

            pi.blocage           = MnemonicStatsDispatcher.Int_Apply(summon.blocage, spellCaster.blocage);
            pi.cd                = MnemonicStatsDispatcher.Int_Apply(summon.cd, spellCaster.cd);
            pi.BuffsList         = new List <Actor.Buff>();
            pi.maxHealth         = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.currentHealth     = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.currentPc         = MnemonicStatsDispatcher.Int_Apply(summon.pc, spellCaster.originalPc);
            pi.currentPm         = MnemonicStatsDispatcher.Int_Apply(summon.pm, spellCaster.originalPm);
            pi.classeName        = spellCaster.classeName;
            pi.domDotonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domDotonFix, spellCaster.domDotonFix);
            pi.domFix            = MnemonicStatsDispatcher.Int_Apply(summon.domFix, spellCaster.domFix);
            pi.domFutonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domFutonFix, spellCaster.domFutonFix);
            pi.domKatonFix       = MnemonicStatsDispatcher.Int_Apply(summon.domKatonFix, spellCaster.domKatonFix);
            pi.domRaitonFix      = MnemonicStatsDispatcher.Int_Apply(summon.domRaitonFix, spellCaster.domRaitonFix);
            pi.domSuitonFix      = MnemonicStatsDispatcher.Int_Apply(summon.domSuitonFix, spellCaster.domSuitonFix);
            pi.doton             = MnemonicStatsDispatcher.Int_Apply(summon.doton, spellCaster.doton);
            pi.dodgeCD           = MnemonicStatsDispatcher.Int_Apply(summon.dodgeCD, spellCaster.dodgeCD);
            pi.dodgePC           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePC, spellCaster.dodgePC);
            pi.dodgePE           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePE, spellCaster.dodgePE);
            pi.dodgePM           = MnemonicStatsDispatcher.Int_Apply(summon.dodgePM, spellCaster.dodgePM);
            pi.escape            = MnemonicStatsDispatcher.Int_Apply(summon.escape, spellCaster.escape);
            pi.futon             = MnemonicStatsDispatcher.Int_Apply(summon.futon, spellCaster.futon);
            pi.idBattle          = spellCaster.idBattle;
            pi.summons           = MnemonicStatsDispatcher.Int_Apply(summon.summons, spellCaster.summons);
            pi.katon             = MnemonicStatsDispatcher.Int_Apply(summon.katon, spellCaster.katon);
            pi.level             = spell_Template.level;
            pi.maskColorString   = MnemonicStatsDispatcher.Str_Apply(summon.MaskColors, spellCaster.maskColorString);
            pi.map               = spellCaster.map;
            pi.directionLook     = 0;
            pi.originalPc        = MnemonicStatsDispatcher.Int_Apply(summon.pc, spellCaster.originalPc);
            pi.originalPm        = MnemonicStatsDispatcher.Int_Apply(summon.pm, spellCaster.originalPm);
            pi.owner             = spellCaster.Pseudo;
            pi.pe                = MnemonicStatsDispatcher.Int_Apply(summon.pe, spellCaster.pe);
            pi.Pseudo            = MnemonicStatsDispatcher.Str_Apply(summon.name, spellCaster.Pseudo);;
            pi.raiton            = MnemonicStatsDispatcher.Int_Apply(summon.raiton, spellCaster.raiton);
            pi.resiDotonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiDotonFix, spellCaster.resiDotonFix);
            pi.resiDotonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiDotonPercent, spellCaster.resiDotonPercent);
            pi.resiFix           = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.resiFutonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiFutonFix, spellCaster.resiFutonFix);
            pi.resiFutonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.resiKatonFix      = MnemonicStatsDispatcher.Int_Apply(summon.resiKatonFix, spellCaster.resiKatonFix);
            pi.resiKatonPercent  = MnemonicStatsDispatcher.Int_Apply(summon.resiKatonPercent, spellCaster.resiKatonPercent);
            pi.resiRaitonFix     = MnemonicStatsDispatcher.Int_Apply(summon.resiRaitonFix, spellCaster.resiRaitonFix);
            pi.resiRaitonPercent = MnemonicStatsDispatcher.Int_Apply(summon.resiRaitonPercent, spellCaster.resiRaitonPercent);
            pi.resiSuitonFix     = MnemonicStatsDispatcher.Int_Apply(summon.resiSuitonFix, spellCaster.resiSuitonFix);
            pi.resiSuitonPercent = MnemonicStatsDispatcher.Int_Apply(summon.resiFix, spellCaster.resiFix);
            pi.removeCD          = MnemonicStatsDispatcher.Int_Apply(summon.retraitCD, spellCaster.removeCD);
            pi.removePC          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPC, spellCaster.removePC);
            pi.removePE          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPE, spellCaster.removePE);
            pi.removePM          = MnemonicStatsDispatcher.Int_Apply(summon.retraitPM, spellCaster.removePM);
            pi.sexe              = spellCaster.sexe;

            for (int cnt = 0; cnt < summon.sorts.Split('/').Length; cnt++)
            {
                string tmp_data = summon.sorts.Split('/')[cnt];
                Actor.SpellsInformations _info_sorts = new Actor.SpellsInformations();
                _info_sorts.SpellId    = Convert.ToInt32(tmp_data.Split(':')[0]);
                _info_sorts.SpellPlace = Convert.ToInt32(tmp_data.Split(':')[1]);
                _info_sorts.Level      = Convert.ToInt32(tmp_data.Split(':')[2]);
                _info_sorts.SpellColor = Convert.ToInt32(tmp_data.Split(':')[3]);
                _info_sorts.effect     = Cryptography.crypted_data.effects_decoder(_info_sorts.SpellId, _info_sorts.Level);
                pi.sorts.Add(_info_sorts);
            }

            pi.species   = Species.Name.Summon;
            pi.suiton    = MnemonicStatsDispatcher.Int_Apply(summon.suiton, spellCaster.suiton);
            pi.maxHealth = MnemonicStatsDispatcher.Int_Apply(summon.TotalPdv, spellCaster.maxHealth);
            pi.teamSide  = spellCaster.teamSide;
            int.TryParse(effect.flag2, out pi.summonID);
            pi.visible = true;

            return(pi);
        }
Пример #12
0
        public static string Apply(object[] parameters)
        {
            // flag 1 = id de la classe qui se trouve dans la table Classes afin de soustraire les caractèristique de l'invocation
            // flag 2 = caracteristique a booster
            // flag 3 = valeur
            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID);
            //NetConnection nim = MainClass.netServer.Connections.Find(f => f.Tag != null && (f.Tag as PlayerInfo).Pseudo == spellCaster.Pseudo);

            //Actor.SpellsInformations infos_sorts = spellCaster.sorts.Find(f => f.sortID == spellID);
            //mysql.spells spell_Template = (DataBase.DataTables.spells as List<mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.level);

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);
            ////////////////////////////////////////////////////////////////////////

            int summonID = Convert.ToInt32(effect.flag1);

            // si sacrifiedSummon est null alors il y à un problème puisque l'invocation dois exister, et que les ancien controle faite n'ont pas vérifier s'il y avais une invoc ou pas, a voir SERVER.Effects.EffectBase.killSummonToBoost pourquoi elle na pas vérifier
            Actor sacrifiedSummon = affectedPlayers.Find(f => f.AffectedActor.summonID == summonID && f.AffectedActor.owner == spellCaster.Pseudo && f.AffectedActor.species == Species.Name.Summon).AffectedActor;

            // elimination de l'invocation qui se trouve dans la liste affected
            affectedPlayers.RemoveAll(f => f.AffectedActor.summonID == summonID && f.AffectedActor.owner == spellCaster.Pseudo && f.AffectedActor.species == Species.Name.Summon);

            string Segment = "";

            foreach (ZoneEffect.ZoneEffectTemplate zet in affectedPlayers)
            {
                Type feature = Type.GetType("SERVER.Features.Handlers." + effect.flag2);
                if (feature != null)
                {
                    System.Reflection.MethodInfo featureHandler = feature.GetMethod("Apply");
                    if (featureHandler != null)
                    {
                        object[] featureParameters = new object[7];
                        featureParameters[0] = spellCaster;
                        featureParameters[1] = zet;
                        featureParameters[2] = sacrifiedSummon;
                        featureParameters[3] = effect.flag3;
                        featureParameters[4] = spell;
                        featureParameters[5] = effect;
                        featureParameters[6] = cd;

                        Segment += featureHandler.Invoke(null, new object[] { featureParameters }) + "/";
                    }
                    else
                    {
                        Console.WriteLine("There's no methode called 'Apply' for character feature called '" + effect.flag2 + "'");
                    }
                }
                else
                {
                    Console.WriteLine("There's no handler for '" + effect.flag2 + "' character feature in SERVER.Features.Handlers");
                }
            }

            if (Segment != "")
            {
                Segment = Segment.Substring(0, Segment.Length - 1);
            }
            else
            {
                Segment = "null";
            }

            // supression de l'invocation
            // retirer le joueur de la liste des joueurs en vie
            string playerDead = sacrifiedSummon.Pseudo;

            _battle.DeadPlayers.Add((Actor)(_battle.AllPlayersByOrder.Find(f => f.Pseudo == sacrifiedSummon.Pseudo)).Clone());
            _battle.AllPlayersByOrder.RemoveAll(f => f.Pseudo == sacrifiedSummon.Pseudo);
            _battle.SideA.RemoveAll(f => f.Pseudo == sacrifiedSummon.Pseudo);
            _battle.SideB.RemoveAll(f => f.Pseudo == sacrifiedSummon.Pseudo);

            string buffer = "typeRox:desinvocation|cd:" + cd + "|chakra:neutre|deadList:" + playerDead + "|" + Segment;

            return(buffer);
        }
Пример #13
0
        private void add_Click(object sender, EventArgs e)
        {
            ///////////////////////////////////////////////////////////
            ComboBox _targetSelection = new ComboBox();
            Label    label5           = new Label();
            TextBox  _effectID        = new TextBox();
            Label    label4           = new Label();
            ComboBox _effectBase      = new ComboBox();
            Label    label3           = new Label();
            ComboBox _targets         = new ComboBox();
            Button   Ajouter          = new Button();
            Label    label6           = new Label();
            ComboBox _element         = new ComboBox();
            Label    label7           = new Label();
            TextBox  _duration        = new TextBox();
            TextBox  _delay           = new TextBox();
            Label    label8           = new Label();
            TextBox  _zoneSize        = new TextBox();
            Label    label9           = new Label();
            Label    label10          = new Label();
            ComboBox _zoneExtensible  = new ComboBox();
            TextBox  _handToHand      = new TextBox();
            Label    label11          = new Label();
            TextBox  _max             = new TextBox();
            Label    label12          = new Label();
            TextBox  _min             = new TextBox();
            Label    label13          = new Label();
            TextBox  _flag1           = new TextBox();
            Label    label15          = new Label();
            TextBox  _flag2           = new TextBox();
            Label    label14          = new Label();
            TextBox  _flag3           = new TextBox();
            Label    label16          = new Label();
            Button   button1          = new Button();
            Button   button2          = new Button();

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID.ToString() == spellID.Text && f.level.ToString() == level.Text);

            TabPage tp;

            if (effectTab.TabPages[0].Controls.Count == 0)
            {
                tp = effectTab.SelectedTab;
            }
            else
            {
                tp = new TabPage();
                effectTab.TabPages.Add(tp);
                effectTab.SelectTab(effectTab.TabCount - 1);
            }

            tp.Controls.Add(button2);
            tp.Controls.Add(_flag3);
            tp.Controls.Add(label16);
            tp.Controls.Add(_flag2);
            tp.Controls.Add(label14);
            tp.Controls.Add(_flag1);
            tp.Controls.Add(label15);
            tp.Controls.Add(_max);
            tp.Controls.Add(label12);
            tp.Controls.Add(_min);
            tp.Controls.Add(label13);
            tp.Controls.Add(_handToHand);
            tp.Controls.Add(label11);
            tp.Controls.Add(_zoneExtensible);
            tp.Controls.Add(label10);
            tp.Controls.Add(_zoneSize);
            tp.Controls.Add(label9);
            tp.Controls.Add(_delay);
            tp.Controls.Add(label8);
            tp.Controls.Add(_duration);
            tp.Controls.Add(label7);
            tp.Controls.Add(_element);
            tp.Controls.Add(label6);
            tp.Controls.Add(Ajouter);
            tp.Controls.Add(_targets);
            tp.Controls.Add(_targetSelection);
            tp.Controls.Add(label5);
            tp.Controls.Add(_effectID);
            tp.Controls.Add(label4);
            tp.Controls.Add(_effectBase);
            tp.Controls.Add(label3);


            //
            // targetSelection
            //
            _targetSelection.DropDownStyle     = ComboBoxStyle.DropDownList;
            _targetSelection.FormattingEnabled = true;
            _targetSelection.Items.AddRange(new object[] {
                "self",
                "enemy_1",
                "ally_1",
                "none",
                "ally_summon",
                "enemy_summon"
            });
            _targetSelection.Location = new Point(233, 67);
            _targetSelection.Name     = "targetSelection";
            _targetSelection.Size     = new Size(121, 21);
            _targetSelection.TabIndex = 5;
            //
            // label5
            //
            label5.AutoSize = true;
            label5.Location = new Point(17, 70);
            label5.Name     = "label5";
            label5.Size     = new Size(38, 13);
            label5.TabIndex = 4;
            label5.Text     = "Target";
            //
            // effectID
            //
            _effectID.Location = new Point(106, 42);
            _effectID.Name     = "effectID";
            _effectID.Size     = new Size(52, 20);
            _effectID.TabIndex = 3;
            //
            // label4
            //
            label4.AutoSize = true;
            label4.Location = new Point(17, 45);
            label4.Name     = "label4";
            label4.Size     = new Size(46, 13);
            label4.TabIndex = 2;
            label4.Text     = "EffectID";
            //
            // effectBase
            //
            _effectBase.DropDownStyle     = ComboBoxStyle.DropDownList;
            _effectBase.FormattingEnabled = true;
            _effectBase.Items.AddRange(new object[] {
                "dammage",
                "defaultDamage",
                "heal",
                "summon",
                "drain_life",
                "drain_pc",
                "drain_pm",
                "drain_power",
                "mode",
                "boost",
                "killSummonToBoost",
                "state"
            });
            _effectBase.Location = new Point(106, 16);
            _effectBase.Name     = "effectBase";
            _effectBase.Size     = new Size(121, 21);
            _effectBase.TabIndex = 1;
            //
            // label3
            //
            label3.AutoSize = true;
            label3.Location = new Point(17, 20);
            label3.Name     = "label3";
            label3.Size     = new Size(59, 13);
            label3.TabIndex = 0;
            label3.Text     = "EffectBase";
            //
            // targets
            //
            _targets.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            _targets.FormattingEnabled = true;
            _targets.Location          = new System.Drawing.Point(106, 67);
            _targets.Name     = "targets";
            _targets.Size     = new System.Drawing.Size(121, 21);
            _targets.TabIndex = 6;
            //
            // Ajouter
            //
            Ajouter.Location = new System.Drawing.Point(360, 66);
            Ajouter.Name     = "Ajouter";
            Ajouter.Size     = new System.Drawing.Size(75, 23);
            Ajouter.TabIndex = 7;
            Ajouter.Text     = "add";
            Ajouter.UseVisualStyleBackColor = true;
            Ajouter.Click += new System.EventHandler(Ajouter_Click);
            //
            // label6
            //
            label6.AutoSize = true;
            label6.Location = new System.Drawing.Point(17, 96);
            label6.Name     = "label6";
            label6.Size     = new System.Drawing.Size(45, 13);
            label6.TabIndex = 8;
            label6.Text     = "Element";
            //
            // element
            //
            _element.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            _element.FormattingEnabled = true;
            _element.Items.AddRange(new object[] {
                "doton",
                "katon",
                "futon",
                "suiton",
                "raiton",
                "neutre"
            });
            _element.Location = new System.Drawing.Point(106, 93);
            _element.Name     = "element";
            _element.Size     = new System.Drawing.Size(121, 21);
            _element.TabIndex = 9;
            //
            // label7
            //
            label7.AutoSize = true;
            label7.Location = new System.Drawing.Point(17, 123);
            label7.Name     = "label7";
            label7.Size     = new System.Drawing.Size(47, 13);
            label7.TabIndex = 10;
            label7.Text     = "Duration";
            //
            // duration
            //
            _duration.Location = new System.Drawing.Point(106, 119);
            _duration.Name     = "duration";
            _duration.Size     = new System.Drawing.Size(52, 20);
            _duration.TabIndex = 11;
            //
            // delay
            //
            _delay.Location = new System.Drawing.Point(106, 144);
            _delay.Name     = "delay";
            _delay.Size     = new System.Drawing.Size(52, 20);
            _delay.TabIndex = 13;
            //
            // label8
            //
            label8.AutoSize = true;
            label8.Location = new System.Drawing.Point(17, 148);
            label8.Name     = "label8";
            label8.Size     = new System.Drawing.Size(34, 13);
            label8.TabIndex = 12;
            label8.Text     = "Delay";
            //
            // zoneSize
            //
            _zoneSize.Location = new System.Drawing.Point(106, 169);
            _zoneSize.Name     = "zoneSize";
            _zoneSize.Size     = new System.Drawing.Size(52, 20);
            _zoneSize.TabIndex = 15;
            //
            // label9
            //
            label9.AutoSize = true;
            label9.Location = new System.Drawing.Point(17, 173);
            label9.Name     = "label9";
            label9.Size     = new System.Drawing.Size(55, 13);
            label9.TabIndex = 14;
            label9.Text     = "Zone Size";
            //
            // label10
            //
            label10.AutoSize = true;
            label10.Location = new System.Drawing.Point(17, 200);
            label10.Name     = "label10";
            label10.Size     = new System.Drawing.Size(83, 13);
            label10.TabIndex = 16;
            label10.Text     = "Zone Extensible";
            //
            // zoneExtensible
            //
            _zoneExtensible.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
            _zoneExtensible.FormattingEnabled = true;
            _zoneExtensible.Items.AddRange(new object[] {
                "true",
                "false"
            });
            _zoneExtensible.Location = new System.Drawing.Point(106, 195);
            _zoneExtensible.Name     = "zoneExtensible";
            _zoneExtensible.Size     = new System.Drawing.Size(66, 21);
            _zoneExtensible.TabIndex = 17;
            //
            // handToHand
            //
            _handToHand.Location = new System.Drawing.Point(105, 223);
            _handToHand.Name     = "handToHand";
            _handToHand.Size     = new System.Drawing.Size(52, 20);
            _handToHand.TabIndex = 19;
            //
            // label11
            //
            label11.AutoSize = true;
            label11.Location = new System.Drawing.Point(17, 227);
            label11.Name     = "label11";
            label11.Size     = new System.Drawing.Size(72, 13);
            label11.TabIndex = 18;
            label11.Text     = "HandToHand";
            //
            // Max
            //
            _max.Location = new System.Drawing.Point(432, 147);
            _max.Name     = "Max";
            _max.Size     = new System.Drawing.Size(52, 20);
            _max.TabIndex = 23;
            //
            // label12
            //
            label12.AutoSize = true;
            label12.Location = new System.Drawing.Point(343, 151);
            label12.Name     = "label12";
            label12.Size     = new System.Drawing.Size(27, 13);
            label12.TabIndex = 22;
            label12.Text     = "Max";
            //
            // Min
            //
            _min.Location = new System.Drawing.Point(432, 122);
            _min.Name     = "Min";
            _min.Size     = new System.Drawing.Size(52, 20);
            _min.TabIndex = 21;
            //
            // label13
            //
            label13.AutoSize = true;
            label13.Location = new System.Drawing.Point(343, 126);
            label13.Name     = "label13";
            label13.Size     = new System.Drawing.Size(24, 13);
            label13.TabIndex = 20;
            label13.Text     = "Min";
            //
            // flag1
            //
            _flag1.Location = new System.Drawing.Point(432, 172);
            _flag1.Name     = "flag1";
            _flag1.Size     = new System.Drawing.Size(52, 20);
            _flag1.TabIndex = 25;
            //
            // label15
            //
            label15.AutoSize = true;
            label15.Location = new System.Drawing.Point(344, 176);
            label15.Name     = "label15";
            label15.Size     = new System.Drawing.Size(36, 13);
            label15.TabIndex = 24;
            label15.Text     = "Flag 1";
            //
            // flag2
            //
            _flag2.Location = new System.Drawing.Point(432, 198);
            _flag2.Name     = "flag2";
            _flag2.Size     = new System.Drawing.Size(52, 20);
            _flag2.TabIndex = 27;
            //
            // label14
            //
            label14.AutoSize = true;
            label14.Location = new System.Drawing.Point(344, 202);
            label14.Name     = "label14";
            label14.Size     = new System.Drawing.Size(36, 13);
            label14.TabIndex = 26;
            label14.Text     = "Flag 2";
            //
            // flag3
            //
            _flag3.Location = new System.Drawing.Point(432, 223);
            _flag3.Name     = "flag3";
            _flag3.Size     = new System.Drawing.Size(52, 20);
            _flag3.TabIndex = 29;
            //
            // label16
            //
            label16.AutoSize = true;
            label16.Location = new System.Drawing.Point(344, 227);
            label16.Name     = "label16";
            label16.Size     = new System.Drawing.Size(36, 13);
            label16.TabIndex = 28;
            label16.Text     = "Flag 3";
            //
            // button1
            //
            button1.Location = new System.Drawing.Point(132, 342);
            button1.Name     = "button1";
            button1.Size     = new System.Drawing.Size(286, 36);
            button1.TabIndex = 30;
            button1.Text     = "Save";
            button1.UseVisualStyleBackColor = true;
            //
            // button2
            //
            button2.Location = new System.Drawing.Point(438, 66);
            button2.Name     = "button2";
            button2.Size     = new System.Drawing.Size(75, 23);
            button2.TabIndex = 30;
            button2.Text     = "remove";
            button2.UseVisualStyleBackColor = true;
            button2.Click += new System.EventHandler(button2_Click);

            (tp.Controls.Find("effectBase", false)[0] as ComboBox).SelectedIndex     = 0;
            (tp.Controls.Find("element", false)[0] as ComboBox).SelectedIndex        = 0;
            (tp.Controls.Find("zoneExtensible", false)[0] as ComboBox).SelectedIndex = 0;
            tp.Text           = "Effect " + (effectTab.TabCount);
            effectTab.Enabled = true;
        }
Пример #14
0
        private void filter_Click(object sender, EventArgs e)
        {
            int _spellID, _level;

            if (!int.TryParse(spellID.Text, out _spellID))
            {
                MessageBox.Show("le spellID n'est pas un nombre entier numérique");
                return;
            }

            if (!int.TryParse(level.Text, out _level))
            {
                MessageBox.Show("le level n'est pas un nombre entier numérique");
                return;
            }

            if (_spellID < 0)
            {
                MessageBox.Show("le spellID dois être supérieur ou égale à 0");
                return;
            }

            if (_level < 1)
            {
                MessageBox.Show("le level dois être supérieur ou égale à 1");
                return;
            }
            effectTab.TabPages.Clear();
            TabPage tempTP = new TabPage();

            effectTab.TabPages.Add(tempTP);
            effectTab.TabPages[0].Text = "Effect 1";

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID.ToString() == spellID.Text && f.level.ToString() == level.Text);
            if (spell == null)
            {
                MessageBox.Show("Sort introuvable");
            }
            else if (spell.extraDataEffect == "" || spell.extraDataEffect == null)
            {
                MessageBox.Show("Aucun effets est affecté a ce sort");
            }
            else
            {
                string[] effects = spell.extraDataEffect.Split('|');

                for (int cnt = 0; cnt < effects.Length; cnt++)
                {
                    string[] data = effects[cnt].Split('#');

                    string   effectBase     = data[0];
                    string   effectID       = data[1];
                    string[] targets        = data[2].Split('/');
                    string   element        = data[3];
                    string   duration       = data[4];
                    string   delay          = data[5];
                    string   zoneSize       = data[6];
                    string   zoneExtensible = data[7];
                    string   handToHand     = data[8];
                    string   min            = data[9];
                    string   max            = data[10];
                    string   flag1          = data[11];
                    string   flag2          = data[12];
                    string   flag3          = data[13];

                    if (cnt > 0)
                    {
                        TabPage tp = new TabPage();
                        effectTab.TabPages.Add(tp);
                    }
                    ///////////////////////////////////////////////////////////
                    ComboBox   _targetSelection = new ComboBox();
                    Label      label5           = new Label();
                    TextBox    _effectID        = new TextBox();
                    Label      label4           = new Label();
                    ComboBox   _effectBase      = new ComboBox();
                    Label      label3           = new Label();
                    ComboBox   _targets         = new ComboBox();
                    Button     Ajouter          = new Button();
                    Label      label6           = new Label();
                    ComboBox   _element         = new ComboBox();
                    Label      label7           = new Label();
                    TextBox    _duration        = new TextBox();
                    TextBox    _delay           = new TextBox();
                    Label      label8           = new Label();
                    TextBox    _zoneSize        = new TextBox();
                    Label      label9           = new Label();
                    Label      label10          = new Label();
                    ComboBox   _zoneExtensible  = new ComboBox();
                    TextBox    _handToHand      = new TextBox();
                    Label      label11          = new Label();
                    TextBox    _max             = new TextBox();
                    Label      label12          = new Label();
                    TextBox    _min             = new TextBox();
                    Label      label13          = new Label();
                    TextBox    _flag1           = new TextBox();
                    Label      label15          = new Label();
                    TextBox    _flag2           = new TextBox();
                    Label      label14          = new Label();
                    TextBox    _flag3           = new TextBox();
                    Label      label16          = new Label();
                    Button     button1          = new Button();
                    Button     button2          = new Button();
                    PictureBox flag1Indicator   = new PictureBox();
                    PictureBox flag2Indicator   = new PictureBox();
                    PictureBox flag3Indicator   = new PictureBox();

                    effectTab.TabPages[cnt].Controls.Add(button2);
                    effectTab.TabPages[cnt].Controls.Add(_flag3);
                    effectTab.TabPages[cnt].Controls.Add(label16);
                    effectTab.TabPages[cnt].Controls.Add(_flag2);
                    effectTab.TabPages[cnt].Controls.Add(label14);
                    effectTab.TabPages[cnt].Controls.Add(_flag1);
                    effectTab.TabPages[cnt].Controls.Add(label15);
                    effectTab.TabPages[cnt].Controls.Add(_max);
                    effectTab.TabPages[cnt].Controls.Add(label12);
                    effectTab.TabPages[cnt].Controls.Add(_min);
                    effectTab.TabPages[cnt].Controls.Add(label13);
                    effectTab.TabPages[cnt].Controls.Add(_handToHand);
                    effectTab.TabPages[cnt].Controls.Add(label11);
                    effectTab.TabPages[cnt].Controls.Add(_zoneExtensible);
                    effectTab.TabPages[cnt].Controls.Add(label10);
                    effectTab.TabPages[cnt].Controls.Add(_zoneSize);
                    effectTab.TabPages[cnt].Controls.Add(label9);
                    effectTab.TabPages[cnt].Controls.Add(_delay);
                    effectTab.TabPages[cnt].Controls.Add(label8);
                    effectTab.TabPages[cnt].Controls.Add(_duration);
                    effectTab.TabPages[cnt].Controls.Add(label7);
                    effectTab.TabPages[cnt].Controls.Add(_element);
                    effectTab.TabPages[cnt].Controls.Add(label6);
                    effectTab.TabPages[cnt].Controls.Add(Ajouter);
                    effectTab.TabPages[cnt].Controls.Add(_targets);
                    effectTab.TabPages[cnt].Controls.Add(_targetSelection);
                    effectTab.TabPages[cnt].Controls.Add(label5);
                    effectTab.TabPages[cnt].Controls.Add(_effectID);
                    effectTab.TabPages[cnt].Controls.Add(label4);
                    effectTab.TabPages[cnt].Controls.Add(_effectBase);
                    effectTab.TabPages[cnt].Controls.Add(label3);
                    effectTab.TabPages[cnt].Controls.Add(flag1Indicator);
                    effectTab.TabPages[cnt].Controls.Add(flag2Indicator);
                    effectTab.TabPages[cnt].Controls.Add(flag3Indicator);
                    //
                    // targetSelection
                    //
                    _targetSelection.DropDownStyle     = ComboBoxStyle.DropDownList;
                    _targetSelection.FormattingEnabled = true;
                    _targetSelection.Items.AddRange(new object[] {
                        "self",
                        "enemy_1",
                        "ally_1",
                        "none",
                        "ally_summon",
                        "enemy_summon"
                    });
                    _targetSelection.Location = new Point(233, 67);
                    _targetSelection.Name     = "targetSelection";
                    _targetSelection.Size     = new Size(121, 21);
                    _targetSelection.TabIndex = 5;
                    //
                    // label5
                    //
                    label5.AutoSize = true;
                    label5.Location = new Point(17, 70);
                    label5.Name     = "label5";
                    label5.Size     = new Size(38, 13);
                    label5.TabIndex = 4;
                    label5.Text     = "Target";
                    //
                    // effectID
                    //
                    _effectID.Location = new Point(106, 42);
                    _effectID.Name     = "effectID";
                    _effectID.Size     = new Size(52, 20);
                    _effectID.TabIndex = 3;
                    //
                    // label4
                    //
                    label4.AutoSize = true;
                    label4.Location = new Point(17, 45);
                    label4.Name     = "label4";
                    label4.Size     = new Size(46, 13);
                    label4.TabIndex = 2;
                    label4.Text     = "EffectID";
                    //
                    // effectBase
                    //
                    _effectBase.DropDownStyle     = ComboBoxStyle.DropDownList;
                    _effectBase.FormattingEnabled = true;
                    _effectBase.Items.AddRange(new object[] {
                        "dammage",
                        "defaultDamage",
                        "heal",
                        "summon",
                        "drain_life",
                        "drain_pc",
                        "drain_pm",
                        "drain_power",
                        "mode",
                        "boost",
                        "killSummonToBoost",
                        "state"
                    });
                    _effectBase.Location = new Point(106, 16);
                    _effectBase.Name     = "effectBase";
                    _effectBase.Size     = new Size(160, 21);
                    _effectBase.TabIndex = 1;
                    //
                    // label3
                    //
                    label3.AutoSize = true;
                    label3.Location = new Point(17, 20);
                    label3.Name     = "label3";
                    label3.Size     = new Size(59, 13);
                    label3.TabIndex = 0;
                    label3.Text     = "EffectBase";
                    //
                    // targets
                    //
                    _targets.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    _targets.FormattingEnabled = true;
                    _targets.Location          = new System.Drawing.Point(106, 67);
                    _targets.Name     = "targets";
                    _targets.Size     = new System.Drawing.Size(121, 21);
                    _targets.TabIndex = 6;
                    //
                    // Ajouter
                    //
                    Ajouter.Location = new System.Drawing.Point(360, 66);
                    Ajouter.Name     = "Ajouter";
                    Ajouter.Size     = new System.Drawing.Size(75, 23);
                    Ajouter.TabIndex = 7;
                    Ajouter.Text     = "add";
                    Ajouter.UseVisualStyleBackColor = true;
                    Ajouter.Click += new System.EventHandler(Ajouter_Click);
                    //
                    // label6
                    //
                    label6.AutoSize = true;
                    label6.Location = new System.Drawing.Point(17, 96);
                    label6.Name     = "label6";
                    label6.Size     = new System.Drawing.Size(45, 13);
                    label6.TabIndex = 8;
                    label6.Text     = "Element";
                    //
                    // element
                    //
                    _element.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    _element.FormattingEnabled = true;
                    _element.Items.AddRange(new object[] {
                        "doton",
                        "katon",
                        "futon",
                        "suiton",
                        "raiton",
                        "neutre"
                    });
                    _element.Location = new System.Drawing.Point(106, 93);
                    _element.Name     = "element";
                    _element.Size     = new System.Drawing.Size(121, 21);
                    _element.TabIndex = 9;
                    //
                    // label7
                    //
                    label7.AutoSize = true;
                    label7.Location = new System.Drawing.Point(17, 123);
                    label7.Name     = "label7";
                    label7.Size     = new System.Drawing.Size(47, 13);
                    label7.TabIndex = 10;
                    label7.Text     = "Duration";
                    //
                    // duration
                    //
                    _duration.Location = new System.Drawing.Point(106, 119);
                    _duration.Name     = "duration";
                    _duration.Size     = new System.Drawing.Size(52, 20);
                    _duration.TabIndex = 11;
                    //
                    // delay
                    //
                    _delay.Location = new System.Drawing.Point(106, 144);
                    _delay.Name     = "delay";
                    _delay.Size     = new System.Drawing.Size(52, 20);
                    _delay.TabIndex = 13;
                    //
                    // label8
                    //
                    label8.AutoSize = true;
                    label8.Location = new System.Drawing.Point(17, 148);
                    label8.Name     = "label8";
                    label8.Size     = new System.Drawing.Size(34, 13);
                    label8.TabIndex = 12;
                    label8.Text     = "Delay";
                    //
                    // zoneSize
                    //
                    _zoneSize.Location = new System.Drawing.Point(106, 169);
                    _zoneSize.Name     = "zoneSize";
                    _zoneSize.Size     = new System.Drawing.Size(52, 20);
                    _zoneSize.TabIndex = 15;
                    //
                    // label9
                    //
                    label9.AutoSize = true;
                    label9.Location = new System.Drawing.Point(17, 173);
                    label9.Name     = "label9";
                    label9.Size     = new System.Drawing.Size(55, 13);
                    label9.TabIndex = 14;
                    label9.Text     = "Zone Size";
                    //
                    // label10
                    //
                    label10.AutoSize = true;
                    label10.Location = new System.Drawing.Point(17, 200);
                    label10.Name     = "label10";
                    label10.Size     = new System.Drawing.Size(83, 13);
                    label10.TabIndex = 16;
                    label10.Text     = "Zone Extensible";
                    //
                    // zoneExtensible
                    //
                    _zoneExtensible.DropDownStyle     = System.Windows.Forms.ComboBoxStyle.DropDownList;
                    _zoneExtensible.FormattingEnabled = true;
                    _zoneExtensible.Items.AddRange(new object[] {
                        "true",
                        "false"
                    });
                    _zoneExtensible.Location = new System.Drawing.Point(106, 195);
                    _zoneExtensible.Name     = "zoneExtensible";
                    _zoneExtensible.Size     = new System.Drawing.Size(66, 21);
                    _zoneExtensible.TabIndex = 17;
                    //
                    // handToHand
                    //
                    _handToHand.Location = new System.Drawing.Point(105, 223);
                    _handToHand.Name     = "handToHand";
                    _handToHand.Size     = new System.Drawing.Size(52, 20);
                    _handToHand.TabIndex = 19;
                    //
                    // label11
                    //
                    label11.AutoSize = true;
                    label11.Location = new System.Drawing.Point(17, 227);
                    label11.Name     = "label11";
                    label11.Size     = new System.Drawing.Size(72, 13);
                    label11.TabIndex = 18;
                    label11.Text     = "HandToHand Distance";
                    //
                    // Max
                    //
                    _max.Location = new System.Drawing.Point(432, 147);
                    _max.Name     = "Max";
                    _max.Size     = new System.Drawing.Size(52, 20);
                    _max.TabIndex = 23;
                    //
                    // label12
                    //
                    label12.AutoSize = true;
                    label12.Location = new System.Drawing.Point(343, 151);
                    label12.Name     = "label12";
                    label12.Size     = new System.Drawing.Size(27, 13);
                    label12.TabIndex = 22;
                    label12.Text     = "Max";
                    //
                    // Min
                    //
                    _min.Location = new System.Drawing.Point(432, 122);
                    _min.Name     = "Min";
                    _min.Size     = new System.Drawing.Size(52, 20);
                    _min.TabIndex = 21;
                    //
                    // label13
                    //
                    label13.AutoSize = true;
                    label13.Location = new System.Drawing.Point(343, 126);
                    label13.Name     = "label13";
                    label13.Size     = new System.Drawing.Size(24, 13);
                    label13.TabIndex = 20;
                    label13.Text     = "Min";
                    //
                    // flag1
                    //
                    _flag1.Location = new System.Drawing.Point(432, 172);
                    _flag1.Name     = "flag1";
                    _flag1.Size     = new System.Drawing.Size(50, 20);
                    _flag1.TabIndex = 25;
                    //
                    // image indicatif
                    //
                    flag1Indicator.Image    = Image.FromFile("information.png");
                    flag1Indicator.SizeMode = PictureBoxSizeMode.AutoSize;
                    flag1Indicator.Location = new Point(_flag1.Location.X + _flag1.Width + 10, _flag1.Location.Y);
                    flag1Indicator.Cursor   = Cursors.Hand;
                    flag1Indicator.Tag      = 1;
                    flag1Indicator.Name     = "flag1Indicator";
                    flag1Indicator.Click   += FlagIndicator_Click;
                    //
                    // label15
                    //
                    label15.AutoSize = true;
                    label15.Location = new System.Drawing.Point(344, 176);
                    label15.Name     = "label15";
                    label15.Size     = new System.Drawing.Size(36, 13);
                    label15.TabIndex = 24;
                    label15.Text     = "Flag 1";
                    //
                    // flag2
                    //
                    _flag2.Location = new System.Drawing.Point(432, 198);
                    _flag2.Name     = "flag2";
                    _flag2.Size     = new System.Drawing.Size(50, 20);
                    _flag2.TabIndex = 27;
                    //
                    // flag2Indicator
                    //
                    flag2Indicator.Image    = Image.FromFile("information.png");
                    flag2Indicator.SizeMode = PictureBoxSizeMode.AutoSize;
                    flag2Indicator.Location = new Point(_flag2.Location.X + _flag2.Width + 10, _flag2.Location.Y);
                    flag2Indicator.Cursor   = Cursors.Hand;
                    flag2Indicator.Tag      = 2;
                    flag2Indicator.Name     = "flag2Indicator";
                    flag2Indicator.Click   += FlagIndicator_Click;
                    //
                    // label14
                    //
                    label14.AutoSize = true;
                    label14.Location = new System.Drawing.Point(344, 202);
                    label14.Name     = "label14";
                    label14.Size     = new System.Drawing.Size(36, 13);
                    label14.TabIndex = 26;
                    label14.Text     = "Flag 2";
                    //
                    // flag3
                    //
                    _flag3.Location = new System.Drawing.Point(432, 223);
                    _flag3.Name     = "flag3";
                    _flag3.Size     = new System.Drawing.Size(50, 20);
                    _flag3.TabIndex = 29;
                    //
                    // flag3Indicator
                    //
                    flag3Indicator.Image    = Image.FromFile("information.png");
                    flag3Indicator.SizeMode = PictureBoxSizeMode.AutoSize;
                    flag3Indicator.Location = new Point(_flag3.Location.X + _flag3.Width + 10, _flag3.Location.Y);
                    flag3Indicator.Cursor   = Cursors.Hand;
                    flag3Indicator.Tag      = 3;
                    flag3Indicator.Name     = "flag3Indicator";
                    flag3Indicator.Click   += FlagIndicator_Click;
                    //
                    // label16
                    //
                    label16.AutoSize = true;
                    label16.Location = new System.Drawing.Point(344, 227);
                    label16.Name     = "label16";
                    label16.Size     = new System.Drawing.Size(36, 13);
                    label16.TabIndex = 28;
                    label16.Text     = "Flag 3";
                    //
                    // button1
                    //
                    button1.Location = new System.Drawing.Point(132, 342);
                    button1.Name     = "button1";
                    button1.Size     = new System.Drawing.Size(286, 36);
                    button1.TabIndex = 30;
                    button1.Text     = "Save";
                    button1.UseVisualStyleBackColor = true;
                    //
                    // button2
                    //
                    button2.Location = new System.Drawing.Point(438, 66);
                    button2.Name     = "button2";
                    button2.Size     = new System.Drawing.Size(75, 23);
                    button2.TabIndex = 30;
                    button2.Text     = "remove";
                    button2.UseVisualStyleBackColor = true;
                    button2.Click += new System.EventHandler(button2_Click);

                    ////////////////////////////////////////////////////////////
                    // on utilise la tabPage1 déjà existante
                    (effectTab.TabPages[cnt].Controls.Find("effectBase", false)[0] as ComboBox).SelectedItem = effectBase;
                    fds.Add(flagDetails.Find(f => f.baseEffect == effectBase));
                    (effectTab.TabPages[cnt].Controls.Find("effectID", false)[0] as TextBox).Text = effectID;
                    foreach (string t in targets)
                    {
                        (effectTab.TabPages[cnt].Controls.Find("targets", false)[0] as ComboBox).Items.Add(t);
                    }

                    foreach (string t in (effectTab.TabPages[cnt].Controls.Find("targets", false)[0] as ComboBox).Items)
                    {
                        (effectTab.TabPages[cnt].Controls.Find("targetSelection", false)[0] as ComboBox).Items.Remove(t);
                    }

                    (effectTab.TabPages[cnt].Controls.Find("element", false)[0] as ComboBox).SelectedItem        = element;
                    (effectTab.TabPages[cnt].Controls.Find("duration", false)[0] as TextBox).Text                = duration;
                    (effectTab.TabPages[cnt].Controls.Find("delay", false)[0] as TextBox).Text                   = delay;
                    (effectTab.TabPages[cnt].Controls.Find("zoneSize", false)[0] as TextBox).Text                = zoneSize;
                    (effectTab.TabPages[cnt].Controls.Find("zoneExtensible", false)[0] as ComboBox).SelectedItem = zoneExtensible;
                    (effectTab.TabPages[cnt].Controls.Find("handToHand", false)[0] as TextBox).Text              = handToHand;
                    (effectTab.TabPages[cnt].Controls.Find("min", false)[0] as TextBox).Text   = min;
                    (effectTab.TabPages[cnt].Controls.Find("max", false)[0] as TextBox).Text   = max;
                    (effectTab.TabPages[cnt].Controls.Find("flag1", false)[0] as TextBox).Text = flag1;
                    (effectTab.TabPages[cnt].Controls.Find("flag2", false)[0] as TextBox).Text = flag2;
                    (effectTab.TabPages[cnt].Controls.Find("flag3", false)[0] as TextBox).Text = flag3;
                    effectTab.TabPages[cnt].Text = "Effect " + (cnt + 1);

                    if (fds[cnt] == null || (fds[cnt] != null && fds[cnt].flag1 == ""))
                    {
                        flag1Indicator.Visible = false;
                    }

                    if (fds[cnt] == null || (fds[cnt] != null && fds[cnt].flag2 == ""))
                    {
                        flag2Indicator.Visible = false;
                    }

                    if (fds[cnt] == null || (fds[cnt] != null && fds[cnt].flag3 == ""))
                    {
                        flag3Indicator.Visible = false;
                    }
                }
                effectTab.Enabled = true;
            }
        }
Пример #15
0
        /// <summary>
        /// perpendicular.cs for spells checker PE
        /// </summary>
        ///                          [ ]
        ///                          [ ]
        ///                          [ ]
        /// exemple tile    [ ][ ][ ][x][ ][ ][ ]
        /// ///                      [ ]
        ///                          [ ]
        ///                          [ ]
        public static Enums.LDVChecker.Availability Apply(object[] parameters)
        {
            ///////////////// parames
            Actor spellCaster = parameters[0] as Actor;
            Point spellPoint  = parameters[1] as Point;

            mysql.spells spell = parameters[2] as mysql.spells;
            ////////////////////////////////
            int    pe              = (Convert.ToBoolean(spell.peModifiable) ? spellCaster.pe + spell.pe : spell.pe) + spell.distanceFromMelee;
            Battle _battle         = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);
            bool   inEmptyTileOnly = false;
            List <Enums.spell_effect_target.targets> spell_Targets = CommonCode.SpellTarget(spell);

            if (spell_Targets.Exists(f => f == Enums.spell_effect_target.targets.none) && spell_Targets.Count == 1)
            {
                inEmptyTileOnly = true;
            }
            ////////////////////////////////
            List <Point>         allTuiles     = new List <Point>(); // list qui contiens tous les tuiles affecté par le sort y compris un obstacle ou pas
            List <SortTuileInfo> allTuilesInfo = CommonCode.PerpondicularShapeWithObstacle(spellCaster, spellPoint, spell);

            List <SortTuileInfo> meleeTileInfo = CommonCode.PerpondicularShapeWithoutObstacle(spellCaster, spell.distanceFromMelee);

            foreach (SortTuileInfo sti in meleeTileInfo)
            {
                allTuilesInfo.RemoveAll(f => f.TuilePoint.X == sti.TuilePoint.X && f.TuilePoint.Y == sti.TuilePoint.Y);
            }

            SortTuileInfo focusedTile = allTuilesInfo.Find(f => f.TuilePoint.X == spellPoint.X && f.TuilePoint.Y == spellPoint.Y);

            if (focusedTile != null)
            {
                // les obstacle joueurs sont prise en compte par le sort
                if (!inEmptyTileOnly && !focusedTile.IsBlockingView && focusedTile.IsWalkable)
                {
                    // traitement quand le sort est autorisé sur cette emplacement
                    return(Enums.LDVChecker.Availability.allowed);
                }
                else
                {
                    // traitement quand le sorts n'est pas autorisé, ou la case est un obstale qui est un joueur, walkable = true, blockingview = true
                    if (!inEmptyTileOnly && focusedTile.IsWalkable && focusedTile.IsBlockingView && _battle.AllPlayersByOrder.Exists(f => f.map_position.X == spellPoint.X && f.map_position.Y == spellPoint.Y))
                    {
                        return(Enums.LDVChecker.Availability.allowed);
                    }
                    else if (inEmptyTileOnly && !focusedTile.IsBlockingView && focusedTile.IsWalkable)
                    {
                        return(Enums.LDVChecker.Availability.allowed);
                    }
                    else
                    {
                        return(Enums.LDVChecker.Availability.notAllowed);
                    }
                }
            }
            else
            {
                // le sort est lancé sur un emplacement en dehors de la zone, le joueur triche
                return(Enums.LDVChecker.Availability.outSide);
            }
        }
Пример #16
0
        public static void Apply(object[] parameters)
        {
            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            #region inscription dans les envoutements
            //// ajout du sort dans la liste des envoutements systeme "non debufable"
            if (spellCaster.BuffsList.Exists(f => f.SortID == spellID && f.system))
            {
                // sort trouvé
                Actor.Buff piEnv = spellCaster.BuffsList.Find(f => f.SortID == spellID && f.system);
                foreach (Effects.ZoneEffect.ZoneEffectTemplate affectedPlayerTemplate in affectedPlayers)
                {
                    if (affectedPlayerTemplate.AffectedActor != null)
                    {
                        piEnv.playerRoxed.Add(affectedPlayerTemplate.AffectedActor.Pseudo);
                    }
                    else
                    {
                        piEnv.playerRoxed.Add("null");
                    }
                }
            }
            else
            {
                // ajout du sort dans les envoutements
                Actor.Buff piEnv1 = new Actor.Buff();
                piEnv1.SortID           = spellID;
                piEnv1.title            = spell_Template.spellName;
                piEnv1.Debuffable       = false;
                piEnv1.VisibleToPlayers = false;
                if (affectedPlayers.Count > 0)
                {
                    foreach (Effects.ZoneEffect.ZoneEffectTemplate affectedPlayerTemplate in affectedPlayers)
                    {
                        if (affectedPlayerTemplate.AffectedActor != null)
                        {
                            piEnv1.playerRoxed.Add(affectedPlayerTemplate.AffectedActor.Pseudo);
                        }
                        else
                        {
                            piEnv1.playerRoxed.Add("null");
                        }
                    }
                }
                else
                {
                    piEnv1.playerRoxed.Add("null");
                }
                piEnv1.relanceInterval = spell_Template.relanceInterval;
                piEnv1.BuffState       = Enums.Buff.State.Fin;
                piEnv1.relanceParTour  = spell_Template.relanceParTour;
                piEnv1.system          = true;
                piEnv1.Cd     = cd;
                piEnv1.Player = spellCaster.Pseudo;
                spellCaster.BuffsList.Add(piEnv1);
            }
            #endregion
        }
Пример #17
0
        public static string Apply(object[] parameters)
        {
            Actor spellCaster = parameters[0] as Actor;
            //Effects.ZoneEffect.zoneEffectTemplate affected = parameters[1] as Effects.ZoneEffect.zoneEffectTemplate;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);

            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            // mise en randome du dom sort
            Random rnd = new Random();
            int    jet = rnd.Next(effect.min, effect.max + 1 + ((cd == true) ? spell_Template.cdDomBonnus : 0));

            int element = 0, equipedElement = 0, elementChakraLevel = 0, domElementFix = 0, resiElementFix = 0, resiElementPercent = 0;

            string buffer = "";

            // si aucun joueur n'est attribué, on envoie comme meme une cmd vide dans la partie dédié, pour que au moin en entre dans la boucle foreach
            if (affectedPlayers.Count() == 0)
            {
                ZoneEffect.ZoneEffectTemplate zet = new ZoneEffect.ZoneEffectTemplate();
                zet.AffectedActor = null;
                affectedPlayers.Add(zet);
            }

            foreach (ZoneEffect.ZoneEffectTemplate affected in affectedPlayers)
            {
                if (spell_Template.element.ToLower() == Enums.Chakra.Element.doton.ToString())
                {
                    element            = spellCaster.doton;
                    equipedElement     = spellCaster.equipedDoton;
                    elementChakraLevel = spellCaster.dotonChakraLevel;
                    domElementFix      = spellCaster.domDotonFix;
                    if (affected.AffectedActor != null)
                    {
                        resiElementFix     = affected.AffectedActor.resiDotonFix;
                        resiElementPercent = affected.AffectedActor.resiDotonPercent;
                    }
                }
                else if (spell_Template.element.ToLower() == Enums.Chakra.Element.futon.ToString())
                {
                    element            = spellCaster.futon;
                    equipedElement     = spellCaster.equipedFuton;
                    elementChakraLevel = spellCaster.futonChakraLevel;
                    domElementFix      = spellCaster.domFutonFix;
                    if (affected.AffectedActor != null)
                    {
                        resiElementFix     = affected.AffectedActor.resiFutonFix;
                        resiElementPercent = affected.AffectedActor.resiFutonPercent;
                    }
                }
                else if (spell_Template.element.ToLower() == Enums.Chakra.Element.katon.ToString())
                {
                    element            = spellCaster.katon;
                    equipedElement     = spellCaster.equipedKaton;
                    elementChakraLevel = spellCaster.katonChakraLevel;
                    domElementFix      = spellCaster.domKatonFix;
                    if (affected.AffectedActor != null)
                    {
                        resiElementFix     = affected.AffectedActor.resiKatonFix;
                        resiElementPercent = affected.AffectedActor.resiKatonPercent;
                    }
                }
                else if (spell_Template.element.ToLower() == Enums.Chakra.Element.raiton.ToString())
                {
                    element            = spellCaster.raiton;
                    equipedElement     = spellCaster.equipedRaiton;
                    elementChakraLevel = spellCaster.raitonChakraLevel;
                    domElementFix      = spellCaster.domRaitonFix;
                    if (affected.AffectedActor != null)
                    {
                        resiElementFix     = affected.AffectedActor.resiRaitonFix;
                        resiElementPercent = affected.AffectedActor.resiRaitonPercent;
                    }
                }
                else if (spell_Template.element.ToLower() == Enums.Chakra.Element.suiton.ToString())
                {
                    element            = spellCaster.suiton;
                    equipedElement     = spellCaster.equipedSuiton;
                    elementChakraLevel = spellCaster.suitonChakraLevel;
                    domElementFix      = spellCaster.domSuitonFix;
                    if (affected.AffectedActor != null)
                    {
                        resiElementFix     = affected.AffectedActor.resiSuitonFix;
                        resiElementPercent = affected.AffectedActor.resiSuitonPercent;
                    }
                }

                int dammage = (100 + element + equipedElement + spellCaster.power + spellCaster.equipedPower);
                dammage = (int)(jet * dammage) / 100;
                dammage = (int)(dammage * (1 + (0.1 * elementChakraLevel)));
                dammage = dammage + domElementFix + spellCaster.domFix;

                if (affected.AffectedActor != null)
                {
                    dammage *= affected.Pertinance / 100;                // pour les sort qui tape en zone, tant que c proche du centre tant que le rox est meilleur

                    // déduire les resistances du joueur
                    dammage -= ((dammage * resiElementPercent) / 100);
                    dammage -= affected.AffectedActor.resiFix - resiElementFix;

                    // application des dom sur le personnage
                    affected.AffectedActor.currentHealth -= dammage;
                    affected.AffectedActor.maxHealth     -= (dammage * 5) / 100;
                }

                // determiner si le ou les joueurs est/sont mort et si le combat est terminé, séparé par : s'il sagit de plusieurs
                string playerDead = "";
                if (affected.AffectedActor != null && affected.AffectedActor.currentHealth <= 0)
                {
                    //recalibrage des pdv a 0 pour eviter tout future problème
                    // joueur KO
                    affected.AffectedActor.currentHealth = 0;
                    playerDead = affected.AffectedActor.Pseudo;

                    // retirer le joueur de la liste des joueurs en vie
                    _battle.DeadPlayers.Add((Actor)(_battle.AllPlayersByOrder.Find(f => f.Pseudo == affected.AffectedActor.Pseudo)).Clone());
                    _battle.AllPlayersByOrder.RemoveAll(f => f.Pseudo == affected.AffectedActor.Pseudo);
                    _battle.SideA.RemoveAll(f => f.Pseudo == affected.AffectedActor.Pseudo);
                    _battle.SideB.RemoveAll(f => f.Pseudo == affected.AffectedActor.Pseudo);
                }

                ////////////////////////////////////////////////
                /// a verifier si le joueur est immunisé contre les dom ou autre pour un futur sort
                /// ////////////////////////////////////////////
                if (dammage < 0)
                {
                    dammage = 0;
                }

                // typerox peux etre rox(déduction),heal(augementation)
                buffer += "typeRox:rox|jet:" + jet + "|cd:" + cd + "|chakra:" + spell_Template.element + "|dom:" + dammage + "|deadList:" + playerDead + "|" + ((affected.AffectedActor != null) ? affected.AffectedActor.Pseudo : "null") + "#";
            }
            if (buffer != "")
            {
                buffer = buffer.Substring(0, buffer.Length - 1);
            }

            return(buffer);
        }
Пример #18
0
        public static string Apply(object[] parameters)
        {
            // flag1 = id des states qui se trouve dans la table summon
            // flag2 = idForSummon

            Actor spellCaster = parameters[0] as Actor;
            List <Effects.ZoneEffect.ZoneEffectTemplate> affectedPlayers = parameters[1] as List <Effects.ZoneEffect.ZoneEffectTemplate>;
            int spellID = (int)parameters[2];

            Actor.effects effect   = parameters[3] as Actor.effects;
            bool          cd       = Convert.ToBoolean(parameters[4]);
            Point         spellPos = parameters[5] as Point;

            Actor.SpellsInformations infos_sorts    = spellCaster.sorts.Find(f => f.SpellId == spellID);
            mysql.spells             spell_Template = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == spellID && f.level == infos_sorts.Level);
            Battle _battle = Battle.Battles.Find(f => f.IdBattle == spellCaster.idBattle);

            Lidgren.Network.NetConnection nim = MainClass.netServer.Connections.Find(f => (f.Tag as Actor).Pseudo == spellCaster.Pseudo);

            // check si le joueur a assez de point d'invocation, pour cela, on dois calculer combiens d'invoc il a déja invoqué
            int sumOfInvoc = _battle.AllPlayersByOrder.FindAll(f => f.Pseudo.IndexOf(spellCaster.Pseudo + "$") != -1).Count;

            if (spellCaster.summons <= sumOfInvoc)
            {
                // pas assez de point d'invocation
                CommonCode.SendMessage("cmd•spellNotEnoughInvoc", nim, true);
                Console.WriteLine("<--cmd•spellNotEnoughInvoc to " + spellCaster.Pseudo);
                return("");
            }

            int isAllowedSpellArea = Fight.spellsChecker.isAllowedSpellArea(spell_Template.pe, spellCaster.map_position, spellCaster, _battle, spellPos, 0, false, true);

            if (isAllowedSpellArea == 0)
            {
                // spell autorisé
            }
            else if (isAllowedSpellArea == 1)
            {
                // spell non autorisé, case obstacle
                CommonCode.SendMessage("cmd•spellTileNotAllowed", nim, true);
                Console.WriteLine("<--cmd•spellTileNotAllowed to " + spellCaster.Pseudo);
                return("");
            }
            else if (isAllowedSpellArea == 2)
            {
                // spell non autorisé, pas de porté
                CommonCode.SendMessage("cmd•spellPointNotEnoughPe", nim, true);
                return("");
            }
            else if (isAllowedSpellArea == -1)
            {
                // impossible de determiner la direction, normalement ca deverai le deviner
                return("");
            }

            // creation d'un clone
            mysql.summon _summon = (DataBase.DataTables.summon as List <mysql.summon>).Find(f => f.template_id == Convert.ToInt32(effect.flag1));
            Actor        __clone_jutsu_naruto = Summon.StatsDispatcher.Apply(spellCaster, _summon, spell_Template, effect);

            // creation d'un id aleatoire pour l'invocation
            string rndStr = "";

            // check si le nom de l'invoc est déja dans la liste des joueurs pour eviter un doublons
            while (true)
            {
                rndStr = CommonCode.ReturnRandomId();
                if (!_battle.AllPlayersByOrder.Exists(f => f.Pseudo == __clone_jutsu_naruto.Pseudo + "$" + rndStr))
                {
                    break;
                }
            }

            __clone_jutsu_naruto.Pseudo       = __clone_jutsu_naruto.Pseudo + "$" + rndStr; // separateur entre le nom et le id de l'invocation
            __clone_jutsu_naruto.map_position = spellPos;


            // insert dans la liste
            int index = _battle.AllPlayersByOrder.FindIndex(f => f.Pseudo == spellCaster.Pseudo);

            _battle.AllPlayersByOrder.Insert(index + 1, __clone_jutsu_naruto);

            string buffer = "";

            // conversion des rawdata sort en base64
            string encryptedSpellsRaw = Cryptography.Algo.Encoding.Base64Encode(_summon.sorts);

            //rawData = "typeRox:addInvoc|name:x|cd:x|totalPdv:x";
            string piRaw = __clone_jutsu_naruto.Pseudo + ":" + __clone_jutsu_naruto.classeName + ":" + __clone_jutsu_naruto.spirit + ":" + __clone_jutsu_naruto.spiritLvl.ToString() + ":" + __clone_jutsu_naruto.Pvp.ToString() + ":" + __clone_jutsu_naruto.hiddenVillage + ":" + __clone_jutsu_naruto.maskColorString + ":" + __clone_jutsu_naruto.directionLook.ToString() + ":" + __clone_jutsu_naruto.level.ToString() + ":" + __clone_jutsu_naruto.map + ":" + __clone_jutsu_naruto.officialRang.ToString() + ":" + __clone_jutsu_naruto.currentHealth.ToString() + ":" + __clone_jutsu_naruto.maxHealth.ToString() + ":" + __clone_jutsu_naruto.doton.ToString() + ":" + __clone_jutsu_naruto.katon.ToString() + ":" + __clone_jutsu_naruto.futon.ToString() + ":" + __clone_jutsu_naruto.raiton.ToString() + ":" + __clone_jutsu_naruto.suiton.ToString() + ":" + /*MainClass.chakralvl2*/ 0 + ":" + /*MainClass.chakralvl3*/ 0 + ":" + /*MainClass.chakralvl4*/ 0 + ":" + /*MainClass.chakralvl5*/ 0 + ":" + /*MainClass.chakralvl6*/ 0 + ":" + /*pi.usingDoton.ToString()*/ 0 + ":" + /*pi.usingKaton.ToString()*/ 0 + ":" + /*pi.usingFuton.ToString()*/ 0 + ":" + /*pi.usingRaiton.ToString()*/ 0 + ":" + /*pi.usingSuiton.ToString()*/ 0 + ":" + /*pi.dotonEquiped.ToString()*/ 0 + ":" + /*pi.katonEquiped.ToString()*/ 0 + ":" + /*pi.futonEquiped.ToString()*/ 0 + ":" + /*pi.raitonEquiped.ToString()*/ 0 + ":" + /*pi.suitonEquiped.ToString()*/ 0 + ":" + __clone_jutsu_naruto.originalPc.ToString() + ":" + __clone_jutsu_naruto.originalPm.ToString() + ":" + __clone_jutsu_naruto.pe.ToString() + ":" + __clone_jutsu_naruto.cd.ToString() + ":" + __clone_jutsu_naruto.summons.ToString() + ":" + __clone_jutsu_naruto.initiative.ToString() + ":" + __clone_jutsu_naruto.resiDotonPercent.ToString() + ":" + __clone_jutsu_naruto.resiKatonPercent.ToString() + ":" + __clone_jutsu_naruto.resiFutonPercent.ToString() + ":" + __clone_jutsu_naruto.resiRaitonPercent.ToString() + ":" + __clone_jutsu_naruto.resiSuitonPercent.ToString() + ":" + __clone_jutsu_naruto.dodgePC.ToString() + ":" + __clone_jutsu_naruto.dodgePM.ToString() + ":" + __clone_jutsu_naruto.dodgePE.ToString() + ":" + __clone_jutsu_naruto.dodgeCD.ToString() + ":" + __clone_jutsu_naruto.removePC.ToString() + ":" + __clone_jutsu_naruto.removePM.ToString() + ":" + __clone_jutsu_naruto.removePE.ToString() + ":" + __clone_jutsu_naruto.removeCD.ToString() + ":" + __clone_jutsu_naruto.escape.ToString() + ":" + __clone_jutsu_naruto.blocage.ToString() + ":" + encryptedSpellsRaw + ":" + __clone_jutsu_naruto.resiDotonFix + ":" + __clone_jutsu_naruto.resiKatonFix + ":" + __clone_jutsu_naruto.resiFutonFix + ":" + __clone_jutsu_naruto.resiRaitonFix + ":" + __clone_jutsu_naruto.resiSuitonFix + ":" + __clone_jutsu_naruto.resiFix + ":" + __clone_jutsu_naruto.domDotonFix + ":" + __clone_jutsu_naruto.domKatonFix + ":" + __clone_jutsu_naruto.domFutonFix + ":" + __clone_jutsu_naruto.domRaitonFix + ":" + __clone_jutsu_naruto.domSuitonFix + ":" + __clone_jutsu_naruto.domFix + ":" + __clone_jutsu_naruto.power + ":" + __clone_jutsu_naruto.equipedPower;

            buffer = "typeRox:addInvoc|" + piRaw + "|cd:" + cd;

            return(buffer);
        }