Trom is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

Commit 8

User picture
  • Author: Smarken
  • 2011-10-12 10:28 (over 2 years ago)

Files Affected

 
78
6
using Trom.World;
6
using Trom.World;
7
using System.Runtime.CompilerServices;
7
using System.Runtime.CompilerServices;
8
using System.Timers;
8
using System.Timers;
 
 
9
using System.Threading;
9
 
10
 
10
namespace Trom.DataObject
11
namespace Trom.DataObject
11
{
12
{
...
 
...
 
24
        private static Dictionary<int, List<SpellLevel>> mySpells = new Dictionary<int, List<SpellLevel>>();
25
        private static Dictionary<int, List<SpellLevel>> mySpells = new Dictionary<int, List<SpellLevel>>();
25
        private static Dictionary<long, ItemTemplate> myItemTemplates = new Dictionary<long, ItemTemplate>();
26
        private static Dictionary<long, ItemTemplate> myItemTemplates = new Dictionary<long, ItemTemplate>();
26
        private static Dictionary<int, Experience> myExperienceFloors = new Dictionary<int, Experience>();
27
        private static Dictionary<int, Experience> myExperienceFloors = new Dictionary<int, Experience>();
 
 
28
        private static Dictionary<int, Monster> myMonsters = new Dictionary<int, Monster>();
27
        private static Dictionary<string, Account> myAccountByName = new Dictionary<string, Account>();
29
        private static Dictionary<string, Account> myAccountByName = new Dictionary<string, Account>();
28
        private static Dictionary<int, Account> myAccountById = new Dictionary<int, Account>();
30
        private static Dictionary<int, Account> myAccountById = new Dictionary<int, Account>();
29
        private static List<Character> myCharacters = new List<Character>();
31
        private static List<Character> myCharacters = new List<Character>();
...
 
...
 
78
                    myAccountByName.Add(Account.Name.ToLower(), Account);
80
                    myAccountByName.Add(Account.Name.ToLower(), Account);
79
                }
81
                }
80
 
82
 
81
                var Timer = new Timer(60000);
83
                foreach (var Monster in myEntities.Monster)
 
 
84
                {
 
 
85
                    Monster.Initialize();
 
 
86
                    myMonsters.Add(Monster.MONSTER_ID, Monster);
 
 
87
                }
 
 
88
                                
 
 
89
                var Timer = new System.Timers.Timer(1000 * 60 * 5);
82
                Timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
90
                Timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
83
                {
91
                {
84
                    Save();
92
                    Save();
...
 
...
 
168
        }
176
        }
169
 
177
 
170
        /// <summary>
178
        /// <summary>
 
 
179
        /// Recuperation d'un monstre
 
 
180
        /// </summary>
 
 
181
        /// <param name="MonsterId"></param>
 
 
182
        /// <returns></returns>
 
 
183
        public static Monster GetMonster(int MonsterId)
 
 
184
        {
 
 
185
            Monster Monster;
 
 
186
            myMonsters.TryGetValue(MonsterId, out Monster);
 
 
187
            return Monster;
 
 
188
        }
 
 
189
 
 
 
190
        /// <summary>
171
        /// Retourne le template d'item par son id
191
        /// Retourne le template d'item par son id
172
        /// </summary>
192
        /// </summary>
173
        /// <param name="Id"></param>
193
        /// <param name="Id"></param>
78
68
    AddAgilite = 119,
68
    AddAgilite = 119,
69
    AddChance = 123,
69
    AddChance = 123,
70
    AddDamagePercent = 138,
70
    AddDamagePercent = 138,
 
 
71
    SubDamagePercent = 186,
71
    AddDamageCritic = 115,
72
    AddDamageCritic = 115,
72
    AddDamagePiege = 225,
73
    AddDamagePiege = 225,
73
    //AddDamagePiegePercent = 225,
74
    //AddDamagePiegePercent = 225,
78
2063
    </Options>
2063
    </Options>
2064
    <!-- Diagram content (shape and connector positions) -->
2064
    <!-- Diagram content (shape and connector positions) -->
2065
    <Diagrams>
2065
    <Diagrams>
2066
      <Diagram Name="Model1" ZoomLevel="71" ShowGrid="false" >
2066
      <Diagram Name="Model1" ZoomLevel="52" ShowGrid="false" >
2067
        <EntityTypeShape EntityType="TromModel.Account" Width="1.5" PointX="8" PointY="0.75"
Height="3.0714322916666661" />
2067
        <EntityTypeShape EntityType="TromModel.Account" Width="1.5" PointX="8" PointY="0.75"
Height="3.0714322916666661" />
2068
        <EntityTypeShape EntityType="TromModel.Character" Width="1.75" PointX="10.625" PointY="3.375"
Height="6.6870735677083335" />
2068
        <EntityTypeShape EntityType="TromModel.Character" Width="1.75" PointX="10.625" PointY="3.375"
Height="6.6870735677083335" />
2069
        <AssociationConnector Association="TromModel.AccountCharacter">
2069
        <AssociationConnector Association="TromModel.AccountCharacter">
78
120
 
120
 
121
            /* Statistiques avancés */
121
            /* Statistiques avancés */
122
            {EffectEnum.AddDamage, new List<EffectEnum>() { EffectEnum.SubDamage }},
122
            {EffectEnum.AddDamage, new List<EffectEnum>() { EffectEnum.SubDamage }},
 
 
123
            {EffectEnum.AddDamagePercent, new List<EffectEnum>() { EffectEnum.SubDamagePercent }},
123
            {EffectEnum.AddDamageCritic, new List<EffectEnum>() { EffectEnum.SubDamageCritic }},
124
            {EffectEnum.AddDamageCritic, new List<EffectEnum>() { EffectEnum.SubDamageCritic }},
124
            {EffectEnum.AddDamageMagic, new List<EffectEnum>() { EffectEnum.SubDamageMagic }},
125
            {EffectEnum.AddDamageMagic, new List<EffectEnum>() { EffectEnum.SubDamageMagic }},
125
            {EffectEnum.AddDamagePhysic, new List<EffectEnum>() { EffectEnum.SubDamagePhysic }},
126
            {EffectEnum.AddDamagePhysic, new List<EffectEnum>() { EffectEnum.SubDamagePhysic }},
...
 
...
 
212
                case EffectEnum.AddPM:
213
                case EffectEnum.AddPM:
213
                    Total += GetTotal(EffectEnum.BonusPM);
214
                    Total += GetTotal(EffectEnum.BonusPM);
214
                    break;
215
                    break;
 
 
216
                case EffectEnum.AddRenvoiDamage:
 
 
217
                    Total += GetTotal(EffectEnum.AddRenvoiDamageItem);
 
 
218
                    break;
215
            }
219
            }
216
 
220
 
217
            // malus ?
221
            // malus ?
78
15
        TYPE_MUTANT = -8,
15
        TYPE_MUTANT = -8,
16
        TYPE_MOUNT_PARK = -9,
16
        TYPE_MOUNT_PARK = -9,
17
        TYPE_PRISM = -10,
17
        TYPE_PRISM = -10,
18
 
 
 
19
    }
18
    }
20
 
19
 
21
    public interface IGameActor
20
    public interface IGameActor
78
69
        }
69
        }
70
 
70
 
71
        /// <summary>
71
        /// <summary>
72
        /// Ajoute uen entitées sur la cell
72
        /// Ajoute une entitées sur la cell
73
        /// </summary>
73
        /// </summary>
74
        /// <param name="Actor"></param>
74
        /// <param name="Actor"></param>
75
        public void AddActor(IGameActor Actor)
75
        public void AddActor(IGameActor Actor)
...
 
...
 
80
            // on affecte la cell
80
            // on affecte la cell
81
            Actor.CellId = this.Id;
81
            Actor.CellId = this.Id;
82
 
82
 
83
            if (Actor is Character)
83
            if (Actor.ActorType == GameActorTypeEnum.TYPE_CHARACTER)
84
                foreach (var Action in this.myActions)
84
                foreach (var Action in this.myActions)
85
                    Action.Apply(Actor as Character);        
85
                    Action.Apply(Actor as Character);        
86
        }
86
        }
...
 
...
 
116
    /// </summary>    
116
    /// </summary>    
117
    public partial class Map : IWorldEventObserver, IWorldField
117
    public partial class Map : IWorldEventObserver, IWorldField
118
    {
118
    {
 
 
119
        private static Random RANDOM = new Random();
 
 
120
 
119
        private delegate void GenericWorldClientPacket(PacketBase Packet);
121
        private delegate void GenericWorldClientPacket(PacketBase Packet);
120
        private event GenericWorldClientPacket Event_SendToMap;
122
        private event GenericWorldClientPacket Event_SendToMap;
121
 
123
 
...
 
...
 
125
        // trigger cell
127
        // trigger cell
126
        private List<CellAction> myCellActions = new List<CellAction>();
128
        private List<CellAction> myCellActions = new List<CellAction>();
127
 
129
 
 
 
130
        // liste des monstres possibles
 
 
131
        private List<MonsterLevel> myPossibleMonsters = new List<MonsterLevel>();
 
 
132
 
128
        // action de fin de combat
133
        // action de fin de combat
129
        private List<EndFightAction> myEndFightActions = new List<EndFightAction>();
134
        private List<EndFightAction> myEndFightActions = new List<EndFightAction>();
130
 
135
 
...
 
...
 
146
 
151
 
147
        // prochain Id monsters/npcs etc
152
        // prochain Id monsters/npcs etc
148
        private long myNextActorId = -1;
153
        private long myNextActorId = -1;
 
 
154
        public long NextActorId
 
 
155
        {
 
 
156
            get { return myNextActorId--; }
 
 
157
        }
149
 
158
 
150
        // map parente
159
        // map parente
151
        private Map myMap;
160
        private Map myMap;
...
 
...
 
208
                    if (this.myCells.ContainsKey(Action.CellID))
217
                    if (this.myCells.ContainsKey(Action.CellID))
209
                        this.myCells[Action.CellID].AddAction(Action);
218
                        this.myCells[Action.CellID].AddAction(Action);
210
 
219
 
 
 
220
                this.myInitialized = true;
 
 
221
 
211
                foreach (var Npc in this.myMap.Npcs)
222
                foreach (var Npc in this.myMap.Npcs)
212
                    if (this.myCells.ContainsKey(Npc.CellId))
223
                    if (this.myCells.ContainsKey(Npc.CellId))
213
                    {
224
                    {
214
                        Npc.Initialize(this.myNextActorId--);
225
                        Npc.Initialize(this.myNextActorId--);
215
                        this.myCells[Npc.CellId].AddActor(Npc);
226
                        this.SpawnActor(Npc);
216
                        this.myGameActors.Add(Npc.ActorId, Npc);
 
 
217
                    }
227
                    }
218
               
228
 
219
                this.myInitialized = true;
229
                foreach (var MonsterInfo in this.Monsters.Split('|'))
 
 
230
                {
 
 
231
                    if (MonsterInfo != string.Empty)
 
 
232
                    {
 
 
233
                        try
 
 
234
                        {
 
 
235
                            var MonsterData = MonsterInfo.Split(',');
 
 
236
 
 
 
237
                            var MonsterId = int.Parse(MonsterData[0]);
 
 
238
                            var MonsterLevel = int.Parse(MonsterData[1]);
 
 
239
 
 
 
240
                            var Monster = DatabaseEntities.GetMonster(MonsterId);
 
 
241
 
 
 
242
                            if(Monster != null)
 
 
243
                            {
 
 
244
                                var MonsterGrade = Monster.GetLevel(MonsterLevel);
 
 
245
 
 
 
246
                                if (MonsterGrade != null)
 
 
247
                                {
 
 
248
                                    this.myPossibleMonsters.Add(MonsterGrade);
 
 
249
                                }
 
 
250
                            }
 
 
251
                        }
 
 
252
                        catch (Exception ex)
 
 
253
                        {
 
 
254
                        }
 
 
255
                    }
 
 
256
                }
 
 
257
 
 
 
258
                // On spawn 3 groupes
 
 
259
                this.SpawnMonsterGroup(3);
220
            }
260
            }
221
            catch (Exception ex)
261
            catch (Exception ex)
222
            {
262
            {
...
 
...
 
225
        }
265
        }
226
 
266
 
227
        /// <summary>
267
        /// <summary>
 
 
268
        /// Spawn d'un groupe de monster
 
 
269
        /// </summary>
 
 
270
        [MethodImpl(MethodImplOptions.Synchronized)]
 
 
271
        public void SpawnMonsterGroup(int Count)
 
 
272
        {
 
 
273
            if (Count < 1)
 
 
274
                return;
 
 
275
 
 
 
276
            for (int i = 0; i < Count; i++)
 
 
277
            {
 
 
278
                var Group = new MonsterGroup(this.myPossibleMonsters, this.GrouMaxSize, this.NextActorId);
 
 
279
 
 
 
280
                if (Group.Monsters.Count < 1)
 
 
281
                    continue;
 
 
282
 
 
 
283
                this.SpawnActor(Group);
 
 
284
            }
 
 
285
        }
 
 
286
 
 
 
287
        /// <summary>
228
        /// Verifi si l'on peu marcher sur une case
288
        /// Verifi si l'on peu marcher sur une case
229
        /// </summary>
289
        /// </summary>
230
        /// <param name="CellId"></param>
290
        /// <param name="CellId"></param>
...
 
...
 
238
        }
298
        }
239
 
299
 
240
        /// <summary>
300
        /// <summary>
 
 
301
        /// Retourne une cell valide
 
 
302
        /// </summary>
 
 
303
        /// <returns></returns>
 
 
304
        public int GetFreeCell()
 
 
305
        {
 
 
306
            int CellId = -1;
 
 
307
 
 
 
308
            do
 
 
309
            {
 
 
310
                CellId = RANDOM.Next(50, this.myCells.Count - 1);
 
 
311
            }
 
 
312
            while(!this.myCells[CellId].Walkable);
 
 
313
 
 
 
314
            return CellId;
 
 
315
 
 
 
316
            throw new KeyNotFoundException("Impossible de delivrez une cell libre");
 
 
317
        }
 
 
318
 
 
 
319
        /// <summary>
241
        /// Retounr le nombre de cells
320
        /// Retounr le nombre de cells
242
        /// </summary>
321
        /// </summary>
243
        public int CellsCount
322
        public int CellsCount
...
 
...
 
374
                }
453
                }
375
                else
454
                else
376
                {
455
                {
377
                    // TODO this.SpawnToFreeCell(IGameActor);
456
                    Actor.CellId = this.GetFreeCell();
 
 
457
 
 
 
458
                    this.myCells[Actor.CellId].AddActor(Actor);
378
                }
459
                }
379
            }
460
            }
380
        }
461
        }
...
 
...
 
412
            this.SendToMap(new GameActorDestroyMessage(Actor.ActorId));
493
            this.SendToMap(new GameActorDestroyMessage(Actor.ActorId));
413
        }
494
        }
414
 
495
 
 
 
496
        /// <summary>
 
 
497
        /// Enregistre un client au chat
 
 
498
        /// </summary>
 
 
499
        /// <param name="Client"></param>
415
        public void RegisterToChat(WorldClient Client)
500
        public void RegisterToChat(WorldClient Client)
416
        {
501
        {
417
            Client.RegisterChatChannel(this.myChannel);
502
            Client.RegisterChatChannel(this.myChannel);
...
 
...
 
427
            this.myCells[Actor.CellId].DelActor(Actor);
512
            this.myCells[Actor.CellId].DelActor(Actor);
428
 
513
 
429
            this.myCells[NewCell].AddActor(Actor);
514
            this.myCells[NewCell].AddActor(Actor);
 
 
515
 
 
 
516
            // Uniquement si personnage
 
 
517
            if (Actor.ActorType == GameActorTypeEnum.TYPE_CHARACTER)
 
 
518
            {
 
 
519
                // Changement de map ?
 
 
520
                if ((Actor as Character).Map == this.MAP_ID)
 
 
521
                {
 
 
522
                    foreach(var MGroup in this.myGameActors.Values.OfType<MonsterGroup>())
 
 
523
                    {    
 
 
524
                        if (Pathfinder.GoalDistance(this, NewCell, MGroup.CellId) <= MGroup.Aggrodistance)
 
 
525
                        {
 
 
526
                            if ((MGroup.Alignement != -1) || (Actor as Character).Alignment.AlignmentId != MGroup.Alignement)
 
 
527
                            {
 
 
528
                                this.LaunchMonsterFight((Actor as Character).GetClient(), MGroup);
 
 
529
                                break;
 
 
530
                            }
 
 
531
                        }
 
 
532
                    }
 
 
533
                }
 
 
534
            }
430
        }
535
        }
431
 
536
 
432
        /// <summary>
537
        /// <summary>
 
 
538
        /// Lancement d'un combat
 
 
539
        /// </summary>
 
 
540
        /// <param name="Monsters"></param>
 
 
541
        /// <param name="Player"></param>
 
 
542
        [MethodImpl(MethodImplOptions.Synchronized)]
 
 
543
        public void LaunchMonsterFight(WorldClient Player, MonsterGroup Monsters)
 
 
544
        {
 
 
545
            if (Monsters == null | Player == null)
 
 
546
                return;
 
 
547
 
 
 
548
            // Ne peut pas lancer de combat ?
 
 
549
            if (!Player.CanGameAction(GameActionTypeEnum.FIGHT))
 
 
550
                return;
 
 
551
 
 
 
552
            // Lancement du combat
 
 
553
            this.AddFight(new MonsterFight(this, Player, Monsters));
 
 
554
 
 
 
555
            // Despawn des monstres
 
 
556
            this.DestroyActor(Monsters);
 
 
557
        }
 
 
558
 
 
 
559
        /// <summary>
433
        /// Debut d'un combat sur la map ?
560
        /// Debut d'un combat sur la map ?
434
        /// </summary>
561
        /// </summary>
435
        /// <param name="Fight"></param>
562
        /// <param name="Fight"></param>
Show contents
Show contents
Show contents
78
654
            }
654
            }
655
        }
655
        }
656
 
656
 
 
 
657
        public List<SpellLevel> GetSpells()
 
 
658
        {
 
 
659
                return this.mySpells.Values.Select(x => x.SpellLevel).ToList();
 
 
660
        }
 
 
661
 
657
        public void SerializeAsSpellsListMessage(StringBuilder Packet)
662
        public void SerializeAsSpellsListMessage(StringBuilder Packet)
658
        {
663
        {
659
            lock (this.mySpells)
664
            lock (this.mySpells)
78
69
    <Compile Include="DataObject\ItemTemplate.cs" />
69
    <Compile Include="DataObject\ItemTemplate.cs" />
70
    <Compile Include="DataObject\ItemTypeEnum.cs" />
70
    <Compile Include="DataObject\ItemTypeEnum.cs" />
71
    <Compile Include="DataObject\Map.cs" />
71
    <Compile Include="DataObject\Map.cs" />
 
 
72
    <Compile Include="DataObject\Monster.cs" />
 
 
73
    <Compile Include="DataObject\MonsterGroup.cs" />
 
 
74
    <Compile Include="DataObject\MonsterLevel.cs" />
72
    <Compile Include="DataObject\Npc.cs" />
75
    <Compile Include="DataObject\Npc.cs" />
73
    <Compile Include="DataObject\RestrictionEnum.cs" />
76
    <Compile Include="DataObject\RestrictionEnum.cs" />
74
    <Compile Include="DataObject\SpellBook.cs" />
77
    <Compile Include="DataObject\SpellBook.cs" />
...
 
...
 
88
    <Compile Include="Login\Packets\AccountSecretAnswerMessage.cs" />
91
    <Compile Include="Login\Packets\AccountSecretAnswerMessage.cs" />
89
    <Compile Include="Login\Packets\CharacterCountByServerMessage.cs" />
92
    <Compile Include="Login\Packets\CharacterCountByServerMessage.cs" />
90
    <Compile Include="Util\CellZone.cs" />
93
    <Compile Include="Util\CellZone.cs" />
 
 
94
    <Compile Include="World\Fights\AIProcessor.cs" />
91
    <Compile Include="World\Fights\ChallengeFightRequest.cs" />
95
    <Compile Include="World\Fights\ChallengeFightRequest.cs" />
92
    <Compile Include="World\Fights\CharacterFighter.cs" />
96
    <Compile Include="World\Fights\CharacterFighter.cs" />
93
    <Compile Include="World\Fights\Effects\BuffArmor.cs" />
97
    <Compile Include="World\Fights\Effects\BuffArmor.cs" />
 
 
98
    <Compile Include="World\Fights\Effects\BuffChanceEcaflip.cs" />
94
    <Compile Include="World\Fights\Effects\BuffChatiment.cs" />
99
    <Compile Include="World\Fights\Effects\BuffChatiment.cs" />
 
 
100
    <Compile Include="World\Fights\Effects\BuffDamage.cs" />
 
 
101
    <Compile Include="World\Fights\Effects\BuffDerobade.cs" />
 
 
102
    <Compile Include="World\Fights\Effects\BuffIncreaseSpellJetDamage.cs" />
 
 
103
    <Compile Include="World\Fights\Effects\BuffPorter.cs" />
 
 
104
    <Compile Include="World\Fights\Effects\BuffPorteur.cs" />
95
    <Compile Include="World\Fights\Effects\BuffSacrifice.cs" />
105
    <Compile Include="World\Fights\Effects\BuffSacrifice.cs" />
96
    <Compile Include="World\Fights\Effects\BuffSkin.cs" />
106
    <Compile Include="World\Fights\Effects\BuffSkin.cs" />
97
    <Compile Include="World\Fights\Effects\BuffState.cs" />
107
    <Compile Include="World\Fights\Effects\BuffState.cs" />
...
 
...
 
99
    <Compile Include="World\Fights\Effects\BuffSubPAEsquive.cs" />
109
    <Compile Include="World\Fights\Effects\BuffSubPAEsquive.cs" />
100
    <Compile Include="World\Fights\Effects\EffectArmor.cs" />
110
    <Compile Include="World\Fights\Effects\EffectArmor.cs" />
101
    <Compile Include="World\Fights\Effects\EffectCast.cs" />
111
    <Compile Include="World\Fights\Effects\EffectCast.cs" />
 
 
112
    <Compile Include="World\Fights\Effects\EffectChanceEcaflip.cs" />
102
    <Compile Include="World\Fights\Effects\EffectChatiment.cs" />
113
    <Compile Include="World\Fights\Effects\EffectChatiment.cs" />
103
    <Compile Include="World\Fights\Effects\EffectDamage.cs" />
114
    <Compile Include="World\Fights\Effects\EffectDamage.cs" />
 
 
115
    <Compile Include="World\Fights\Effects\EffectDebuff.cs" />
 
 
116
    <Compile Include="World\Fights\Effects\EffectDerobade.cs" />
104
    <Compile Include="World\Fights\Effects\EffectHeal.cs" />
117
    <Compile Include="World\Fights\Effects\EffectHeal.cs" />
 
 
118
    <Compile Include="World\Fights\Effects\EffectIncreaseSpellJetDamage.cs" />
 
 
119
    <Compile Include="World\Fights\Effects\EffectLancer.cs" />
105
    <Compile Include="World\Fights\Effects\EffectLifeSteal.cs" />
120
    <Compile Include="World\Fights\Effects\EffectLifeSteal.cs" />
 
 
121
    <Compile Include="World\Fights\Effects\EffectLostState.cs" />
 
 
122
    <Compile Include="World\Fights\Effects\EffectPorter.cs" />
106
    <Compile Include="World\Fights\Effects\EffectPushBack.cs" />
123
    <Compile Include="World\Fights\Effects\EffectPushBack.cs" />
107
    <Compile Include="World\Fights\Effects\EffectSacrifice.cs" />
124
    <Compile Include="World\Fights\Effects\EffectSacrifice.cs" />
108
    <Compile Include="World\Fights\Effects\EffectSkin.cs" />
125
    <Compile Include="World\Fights\Effects\EffectSkin.cs" />
109
    <Compile Include="World\Fights\Effects\EffectState.cs" />
126
    <Compile Include="World\Fights\Effects\EffectAddState.cs" />
110
    <Compile Include="World\Fights\Effects\EffectStats.cs" />
127
    <Compile Include="World\Fights\Effects\EffectStats.cs" />
111
    <Compile Include="World\Fights\Effects\EffectStatsSteal.cs" />
128
    <Compile Include="World\Fights\Effects\EffectStatsSteal.cs" />
112
    <Compile Include="World\Fights\Effects\EffectSubPAEsquive.cs" />
129
    <Compile Include="World\Fights\Effects\EffectSubPAEsquive.cs" />
113
    <Compile Include="World\Fights\Effects\EffectTeleport.cs" />
130
    <Compile Include="World\Fights\Effects\EffectTeleport.cs" />
 
 
131
    <Compile Include="World\Fights\Effects\EffectTranspose.cs" />
114
    <Compile Include="World\Fights\FightController.cs" />
132
    <Compile Include="World\Fights\FightController.cs" />
115
    <Compile Include="World\Fights\FighterBuff.cs" />
133
    <Compile Include="World\Fights\FighterBuff.cs" />
116
    <Compile Include="World\Fights\FighterSpell.cs" />
134
    <Compile Include="World\Fights\FighterSpell.cs" />
117
    <Compile Include="World\Fights\FighterState.cs" />
135
    <Compile Include="World\Fights\FighterState.cs" />
 
 
136
    <Compile Include="World\Fights\FightGlyphe.cs" />
 
 
137
    <Compile Include="World\Fights\MonsterFight.cs" />
 
 
138
    <Compile Include="World\Fights\MonsterFighter.cs" />
118
    <Compile Include="World\GameActions\GameChallengeRequest.cs" />
139
    <Compile Include="World\GameActions\GameChallengeRequest.cs" />
119
    <Compile Include="World\GameActions\GameFight.cs" />
140
    <Compile Include="World\GameActions\GameFight.cs" />
120
    <Compile Include="World\GameActions\GameFightCastSpell.cs" />
141
    <Compile Include="World\GameActions\GameFightCastSpell.cs" />
78
156
 
156
 
157
        public static bool InLine(Map Map, int BeginCell, int EndCell)
157
        public static bool InLine(Map Map, int BeginCell, int EndCell)
158
        {
158
        {
159
            return GetX(Map, BeginCell) == GetX(Map, EndCell) || GetY(Map, BeginCell) == GetY(Map, EndCell);
159
            try
 
 
160
            {
 
 
161
                return GetX(Map, BeginCell) == GetX(Map, EndCell) || GetY(Map, BeginCell) == GetY(Map, EndCell);
 
 
162
            }
 
 
163
            catch (Exception ex)
 
 
164
            {
 
 
165
                return false;
 
 
166
            }
160
        }
167
        }
161
 
168
 
162
        public static int GoalDistance(Map Map, int BeginCell, int EndCell)
169
        public static int GoalDistance(Map Map, int BeginCell, int EndCell)
...
 
...
 
224
 
231
 
225
        public static int OppositeDirection(int Direction)
232
        public static int OppositeDirection(int Direction)
226
        {
233
        {
227
            return (Direction >=4 ? Direction - 4 : Direction + 4);
234
            return (Direction >= 4 ? Direction - 4 : Direction + 4);
228
        }
235
        }
229
 
236
 
230
        public static int NextCell(Map Map, int Cell, int Direction)
237
        public static int NextCell(Map Map, int Cell, int Direction)
...
 
...
 
292
                var Length = Pathfinder.IsValidLine(Fight, Fighter, FinalPath, TransitCell, DecodedPath.GetDirection(TransitCell),
DecodedPath.TransitCells[Index + 1]);
299
                var Length = Pathfinder.IsValidLine(Fight, Fighter, FinalPath, TransitCell, DecodedPath.GetDirection(TransitCell),
DecodedPath.TransitCells[Index + 1]);
293
                if (Length == -1)
300
                if (Length == -1)
294
                    return null;
301
                    return null;
295
                else if (Length == -2)                
302
                else if (Length == -2)
296
                    break;
303
                    break;
297
                
304
 
298
                                
305
 
299
                Index++;
306
                Index++;
300
 
307
 
301
            }
308
            }
...
 
...
 
320
            {
327
            {
321
                ActualCell = Pathfinder.NextCell(Map, ActualCell, Direction);
328
                ActualCell = Pathfinder.NextCell(Map, ActualCell, Direction);
322
                if (!Map.IsCellWalkable(ActualCell)) ;
329
                if (!Map.IsCellWalkable(ActualCell)) ;
323
                    //return -1;
 
 
324
               
 
 
325
                //return -1;
330
                //return -1;
 
 
331
 
 
 
332
                //return -1;
326
            }
333
            }
327
 
334
 
328
            return Length;
335
            return Length;
...
 
...
 
349
                Path.MovementLength++;
356
                Path.MovementLength++;
350
 
357
 
351
                if (Pathfinder.IsStopCell(Fighter.Fight, Fighter.Team, ActualCell))
358
                if (Pathfinder.IsStopCell(Fighter.Fight, Fighter.Team, ActualCell))
352
                     return -2;   
359
                    return -2;
353
            }
360
            }
354
 
361
 
355
            return Length;
362
            return Length;
...
 
...
 
359
        {
366
        {
360
            var Ennemies = Pathfinder.GetEnnemyNear(Fighter.Fight, Fighter.Team, Fighter.Cell.Id);
367
            var Ennemies = Pathfinder.GetEnnemyNear(Fighter.Fight, Fighter.Team, Fighter.Cell.Id);
361
 
368
 
362
            if (Ennemies.Count == 0)
369
            if (Ennemies.Count == 0 || Ennemies.All(x => x.States.HasState(FighterStateEnum.STATE_ENRACINER)))
363
                return -1;
370
                return -1;
364
 
371
 
365
            return Pathfinder.TryTacle(Fighter, Ennemies);
372
            return Pathfinder.TryTacle(Fighter, Ennemies);
...
 
...
 
371
            int EnnemiesAgility = 0;
378
            int EnnemiesAgility = 0;
372
 
379
 
373
            foreach (var Ennemy in NearestEnnemies)
380
            foreach (var Ennemy in NearestEnnemies)
374
                EnnemiesAgility += Ennemy.Stats.GetTotal(EffectEnum.AddAgilite);
381
                if (!Ennemy.States.HasState(FighterStateEnum.STATE_ENRACINER)) // Etat enraciner, ne peu pas etre taclé et ne tacle pas
 
 
382
                    EnnemiesAgility += Ennemy.Stats.GetTotal(EffectEnum.AddAgilite);
375
 
383
 
376
            var A = FighterAgility + 25;
384
            var A = FighterAgility + 25;
377
            var B = FighterAgility + EnnemiesAgility + 50;
385
            var B = FighterAgility + EnnemiesAgility + 50;
...
 
...
 
378
            var Chance = (int)((long)(300 * A / B) - 100);
386
            var Chance = (int)((long)(300 * A / B) - 100);
379
            var Rand = Pathfinder.PATHFIND_RANDOM.Next(0, 99);
387
            var Rand = Pathfinder.PATHFIND_RANDOM.Next(0, 99);
380
 
388
 
381
            return Rand > Chance ? Rand : - 1 ;
389
            return Rand > Chance ? Rand : -1;
382
        }
390
        }
383
 
391
 
384
        /// <summary>
392
        /// <summary>
...
 
...
 
399
            return false;
407
            return false;
400
        }
408
        }
401
 
409
 
402
 
 
 
403
        public static List<Fighter> GetEnnemyNear(Fight Fight, FightTeam Team, int CellId)
410
        public static List<Fighter> GetEnnemyNear(Fight Fight, FightTeam Team, int CellId)
404
        {
411
        {
405
            List<Fighter> Ennemies = new List<Fighter>();
412
            List<Fighter> Ennemies = new List<Fighter>();
...
 
...
 
408
            {
415
            {
409
                var Ennemy = Fight.HasEnnemyInCell(Pathfinder.NextCell(Fight.Map, CellId, Direction), Team);
416
                var Ennemy = Fight.HasEnnemyInCell(Pathfinder.NextCell(Fight.Map, CellId, Direction), Team);
410
                if (Ennemy != null)
417
                if (Ennemy != null)
411
                    if(!Ennemy.Dead)
418
                    if (!Ennemy.Dead)
412
                        Ennemies.Add(Ennemy);
419
                        Ennemies.Add(Ennemy);
413
            }
420
            }
414
 
421
 
415
            return Ennemies;
422
            return Ennemies;
416
        }
423
        }
 
 
424
 
 
 
425
        public static int ForViewOrientation(int Orientation)
 
 
426
        {
 
 
427
            switch (Orientation)
 
 
428
            {
 
 
429
                case 0:
 
 
430
                    return 1;
 
 
431
                case 2:
 
 
432
                    return 3;
 
 
433
                case 4:
 
 
434
                    return 5;
 
 
435
                case 6:
 
 
436
                    return 7;
 
 
437
            }
 
 
438
            return 1;
 
 
439
        }
 
 
440
 
 
 
441
        public static int GetAggroDistanceByLevel(int lvl)
 
 
442
        {
 
 
443
            int aggro = 0;
 
 
444
            aggro = (int)(lvl / 50);
 
 
445
            if (lvl > 500)
 
 
446
            {
 
 
447
                aggro = 3;
 
 
448
            }
 
 
449
            return aggro;
 
 
450
        }
417
    }
451
    }
418
}
452
}
78
146
            this.myValidate[this.myClient2] = false;
146
            this.myValidate[this.myClient2] = false;
147
 
147
 
148
            this.Send(new ExchangeValidateMessage(this.myClient1.GetCharacter().CHARACTER_ID, false));
148
            this.Send(new ExchangeValidateMessage(this.myClient1.GetCharacter().CHARACTER_ID, false));
149
            this.Send(new ExchangeValidateMessage(this.myClient1.GetCharacter().CHARACTER_ID, false));
149
            this.Send(new ExchangeValidateMessage(this.myClient2.GetCharacter().CHARACTER_ID, false));
150
        }
150
        }
151
 
151
 
152
        public override bool Validate(WorldClient Client)
152
        public override bool Validate(WorldClient Client)
Show contents
78
14
            : base(FightType.TYPE_CHALLENGE, Map)
14
            : base(FightType.TYPE_CHALLENGE, Map)
15
        {
15
        {
16
            // Init du combat
16
            // Init du combat
17
            var AttFighter = new CharacterFighter(Attacker, this);
17
            var AttFighter = new CharacterFighter(this, Attacker);
18
            var DefFighter = new CharacterFighter(Defender, this);
18
            var DefFighter = new CharacterFighter(this, Defender);
19
 
19
 
20
            Attacker.AddGameAction(new GameFight(AttFighter, this));
20
            Attacker.AddGameAction(new GameFight(AttFighter, this));
21
            Defender.AddGameAction(new GameFight(DefFighter, this));
21
            Defender.AddGameAction(new GameFight(DefFighter, this));
...
 
...
 
33
            return 30000;
33
            return 30000;
34
        }
34
        }
35
 
35
 
36
        public override void EndFight(FightTeam Winners)
36
        StringBuilder mySerializedString;
 
 
37
        public override void SerializeAs_FlagDisplayInformations(StringBuilder Packet)
37
        {
38
        {
38
            switch (this.FightState)
39
            if (this.mySerializedString == null)
39
            {
40
            {
40
                case FightState.STATE_PLACEMENT:
41
                this.mySerializedString = new StringBuilder();
41
                    this.Map.SendToMap(new GameFightFlagDestroyMessage(this.FightId));
42
                this.mySerializedString.Append(this.FightId).Append(';');
42
                    break;
43
                this.mySerializedString.Append((int)this.FightType).Append('|');
43
 
44
                this.mySerializedString.Append(this.myTeam1.LeaderId).Append(';');
44
                case Fights.FightState.STATE_ENDED:
45
                this.mySerializedString.Append(this.myTeam1.Leader.MapCell).Append(';');
45
                    return;
46
                this.mySerializedString.Append('0').Append(';');
 
 
47
                this.mySerializedString.Append("-1").Append('|');
 
 
48
                this.mySerializedString.Append(this.myTeam2.LeaderId).Append(';');
 
 
49
                this.mySerializedString.Append(this.myTeam2.Leader.MapCell).Append(';');
 
 
50
                this.mySerializedString.Append('0').Append(';');
 
 
51
                this.mySerializedString.Append("-1");
46
            }
52
            }
47
            
 
 
48
            this.FightState = Fights.FightState.STATE_ENDED;
 
 
49
            this.FightLoopState = FightLoopState.STATE_END_FIGHT;
 
 
50
 
53
 
51
            var Loosers = (Winners == this.myTeam1 ? this.myTeam2 : this.myTeam1);
54
            Packet.Append(this.mySerializedString.ToString());
 
 
55
        }
52
 
56
 
 
 
57
        public override void EndFight(FightTeam Winners, FightTeam Loosers)
 
 
58
        {    
53
            foreach (var Fighter in Loosers.GetFighters())
59
            foreach (var Fighter in Loosers.GetFighters())
54
                this.myResult.AddResult(Fighter, false);
60
                this.myResult.AddResult(Fighter, false);
55
 
61
 
...
 
...
 
57
                this.myResult.AddResult(Fighter, true);
63
                this.myResult.AddResult(Fighter, true);
58
 
64
 
59
            base.EndFight();
65
            base.EndFight();
60
        }
66
        }   
61
    }
67
    }
62
}
68
}
78
33
            Packet.Append(this.Life).Append(';');
33
            Packet.Append(this.Life).Append(';');
34
            Packet.Append(this.AP).Append(';');
34
            Packet.Append(this.AP).Append(';');
35
            Packet.Append(this.MP).Append(';');
35
            Packet.Append(this.MP).Append(';');
36
            switch (this.myFight.FightType)
36
            switch (this.Fight.FightType)
37
            {
37
            {
38
                case FightType.TYPE_CHALLENGE:
38
                case FightType.TYPE_CHALLENGE:
39
                case FightType.TYPE_AGGRESSION:
39
                case FightType.TYPE_AGGRESSION:
...
 
...
 
52
                    Packet.Append(this.Stats.GetTotal(EffectEnum.AddReduceDamagePourcentAir)).Append(';');
52
                    Packet.Append(this.Stats.GetTotal(EffectEnum.AddReduceDamagePourcentAir)).Append(';');
53
                    break;
53
                    break;
54
            }
54
            }
55
            Packet.Append('0').Append(';'); // TODO Total equive PA
55
            Packet.Append(this.Stats.GetTotal(EffectEnum.AddEsquivePA)).Append(';'); // TODO Total equive PA
56
            Packet.Append('0').Append(';'); // TODO Total equive PM
56
            Packet.Append(this.Stats.GetTotal(EffectEnum.AddEsquivePM)).Append(';'); // TODO Total equive PM
57
            Packet.Append(this.Team.Id).Append(';');
57
            Packet.Append(this.Team.Id).Append(';');
58
            Packet.Append("").Append(';'); // TODO Display Paddock
58
            Packet.Append("").Append(';'); // TODO Display Paddock
59
        }
59
        }
...
 
...
 
95
        {
95
        {
96
            if (this.Client != null)
96
            if (this.Client != null)
97
            {
97
            {
98
                this.Client.UnRegisterWorldEvent(this.myFight);
98
                this.Client.UnRegisterWorldEvent(this.Fight);
99
                this.Client.SetFight(null);
99
                this.Client.SetFight(null);
100
                this.Client.SetFighter(null);
100
                this.Client.SetFighter(null);
101
                this.Client.EndGameAction(GameActionTypeEnum.FIGHT);
101
                this.Client.EndGameAction(GameActionTypeEnum.FIGHT);
...
 
...
 
102
                this.Client.SetState(WorldState.STATE_GAME_CREATE);                             
102
                this.Client.SetState(WorldState.STATE_GAME_CREATE);                             
103
            }
103
            }
104
 
104
 
105
            // Reinit de la vie
105
           if(this.Fight.FightType == FightType.TYPE_CHALLENGE)
106
            this.Character.Life = this.Character.MaxLife;
106
                this.Character.Life = this.Character.MaxLife;
107
 
107
 
108
            base.EndFight();
108
            base.EndFight();
109
        }
109
        }
...
 
...
 
152
            set;
152
            set;
153
        }
153
        }
154
 
154
 
155
        private Fight myFight;
155
        public CharacterFighter(Fight Fight, WorldClient Client)
156
 
156
            : base(Fight, GameActorTypeEnum.TYPE_CHARACTER)
157
        public CharacterFighter(WorldClient Client, Fight Fight)
157
        {          
158
            : base(GameActorTypeEnum.TYPE_CHARACTER, Fight)
 
 
159
        {
 
 
160
            this.myFight = Fight;            
 
 
161
            this.Character = Client.GetCharacter();
158
            this.Character = Client.GetCharacter();
162
            this.Client = Client;
159
            this.Client = Client;
163
 
160
 
...
 
...
 
166
            this.Client.UnRegisterWorldEvent(Fight.Map);
163
            this.Client.UnRegisterWorldEvent(Fight.Map);
167
            this.Client.RegisterWorldEvent(Fight);
164
            this.Client.RegisterWorldEvent(Fight);
168
 
165
 
169
            base.InitFighter(this.Character.GetStats(), this.Character.CHARACTER_ID, this.Character.AP, this.Character.MP, this.Character.Skin);
166
            base.InitFighter(this.Character.GetStats(), this.Character.CHARACTER_ID, this.Character.Skin);
170
        }
167
        }
171
 
168
 
172
        public override void Send(PacketBase Packet)
169
        public override void Send(PacketBase Packet)
78
7
namespace Trom.World.Fights.Effects
7
namespace Trom.World.Fights.Effects
8
{
8
{
9
    public sealed class BuffArmor : BuffEffect
9
    public sealed class BuffArmor : BuffEffect
10
    {
10
    {    
11
        private static Dictionary<EffectEnum, List<EffectEnum>> ArmorByEffect = new Dictionary<EffectEnum, List<EffectEnum>>()
 
 
12
        {
 
 
13
            { EffectEnum.AddArmorFeu,      new List<EffectEnum>() { EffectEnum.DamageFeu    , EffectEnum.VolFeu    } },
 
 
14
            { EffectEnum.AddArmorTerre,    new List<EffectEnum>() { EffectEnum.DamageTerre  , EffectEnum.VolTerre  , EffectEnum.DamageNeutre , EffectEnum.VolNeutre} },                       
 
 
15
            { EffectEnum.AddArmorAir,      new List<EffectEnum>() { EffectEnum.DamageAir    , EffectEnum.VolAir    } },            
 
 
16
            { EffectEnum.AddArmorEau,      new List<EffectEnum>() { EffectEnum.DamageEau    , EffectEnum.VolEau    } },    
 
 
17
            { EffectEnum.AddArmor,         new List<EffectEnum>() { EffectEnum.DamageFeu    , 
 
 
18
                                                                    EffectEnum.VolFeu       ,
 
 
19
                                                                    EffectEnum.DamageTerre  ,
 
 
20
                                                                    EffectEnum.VolTerre     ,
 
 
21
                                                                    EffectEnum.DamageNeutre ,
 
 
22
                                                                    EffectEnum.VolNeutre    , 
 
 
23
                                                                    EffectEnum.DamageAir    , 
 
 
24
                                                                    EffectEnum.VolAir } }
 
 
25
        };
 
 
26
 
 
 
27
        public BuffArmor(EffectCast CastInfos, Fighter Target)
11
        public BuffArmor(EffectCast CastInfos, Fighter Target)
28
            : base(CastInfos, Target, BuffActiveType.ACTIVE_ATTACKED_AFTER_JET, BuffDecrementType.TYPE_ENDTURN)
12
            : base(CastInfos, Target, BuffActiveType.ACTIVE_ATTACKED_AFTER_JET, BuffDecrementType.TYPE_ENDTURN)
29
        {
13
        {
30
        }
14
        }
31
 
15
            
32
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
 
 
33
        {
 
 
34
            // Si aucun dommage
 
 
35
            if (DamageValue == 0)
 
 
36
                return -1;
 
 
37
 
 
 
38
            // Recupere le type d'armure par les dommages
 
 
39
            if (!BuffArmor.ArmorByEffect[this.CastInfos.SubEffect].Contains(DamageInfos.EffectType))
 
 
40
                return -1;
 
 
41
 
 
 
42
            // Calcul armure par l'effect
 
 
43
            var Armor = this.Target.CalculArmor(this.CastInfos.SubEffect);
 
 
44
 
 
 
45
            // Aucune armure
 
 
46
            if (Armor == 0)
 
 
47
                return -1;
 
 
48
 
 
 
49
            // Reduction des dommages
 
 
50
            this.Target.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_ARMOR, this.Target.ActorId, this.Target.ActorId + "," + Armor));
 
 
51
 
 
 
52
            DamageValue -= Armor;
 
 
53
 
 
 
54
            if (DamageValue < 0)
 
 
55
                DamageValue = 0;
 
 
56
 
 
 
57
            return base.ApplyEffect(ref DamageValue, DamageInfos);
 
 
58
        }
 
 
59
 
 
 
60
        public override int RemoveEffect()
16
        public override int RemoveEffect()
61
        {
17
        {
62
            switch (this.CastInfos.SpellId)
18
            switch (this.CastInfos.SpellId)
Show contents
78
15
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
15
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
16
        {
16
        {
17
            var BuffValue = DamageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
17
            var BuffValue = DamageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
18
            var StatsType = (EffectEnum)this.CastInfos.Value1;
18
            var StatsType = (EffectEnum)this.CastInfos.Value1 == EffectEnum.Heal ? EffectEnum.AddVitalite : (EffectEnum)this.CastInfos.Value1;
19
            var MaxValue = this.CastInfos.Value2;
19
            var MaxValue = this.CastInfos.Value2;
20
            var Duration = this.CastInfos.Value3;
20
            var Duration = this.CastInfos.Value3;
21
 
21
 
Show contents
Show contents
78
23
    {
23
    {
24
        TYPE_BEGINTURN,
24
        TYPE_BEGINTURN,
25
        TYPE_ENDTURN,
25
        TYPE_ENDTURN,
 
 
26
        TYPE_ENDMOVE,
26
    }
27
    }
27
 
28
 
28
    /// <summary>
29
    /// <summary>
...
 
...
 
83
            get;
84
            get;
84
            set;
85
            set;
85
        }
86
        }
 
 
87
 
 
 
88
        /// <summary>
 
 
89
        /// Possibilité de debuff ?
 
 
90
        /// </summary>
 
 
91
        public bool IsDebuffable
 
 
92
        {
 
 
93
            get
 
 
94
            {
 
 
95
                switch (this.CastInfos.EffectType)
 
 
96
                {
 
 
97
                    case EffectEnum.Porter:
 
 
98
                    case EffectEnum.AddState:
 
 
99
                    case EffectEnum.ChangeSkin:
 
 
100
                    case EffectEnum.AddChatiment:
 
 
101
                    case EffectEnum.AddPA:
 
 
102
                    case EffectEnum.AddPABis:
 
 
103
                    case EffectEnum.AddPM:
 
 
104
                    case EffectEnum.SubPA:
 
 
105
                    case EffectEnum.SubPAEsquive:
 
 
106
                        return false;
 
 
107
                }
 
 
108
 
 
 
109
                return true;
 
 
110
            }
 
 
111
        }
86
 
112
 
87
        /// <summary>
113
        /// <summary>
88
        /// Constructeur
114
        /// Constructeur
...
 
...
 
111
                                                                               this.CastInfos.SpellId.ToString()));
137
                                                                               this.CastInfos.SpellId.ToString()));
112
                    break;
138
                    break;
113
 
139
 
114
                case EffectEnum.ChanceEcaflip: // Chance eca
140
                case EffectEnum.ChanceEcaflip:
 
 
141
                case EffectEnum.AddChatiment:
115
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
142
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
116
                                                                           this.Target.ActorId,
143
                                                                           this.Target.ActorId,
117
                                                                           this.CastInfos.Value1.ToString(),
144
                                                                           this.CastInfos.Value1.ToString(),
118
                                                                           this.CastInfos.Value2.ToString(),
145
                                                                           this.CastInfos.Value2.ToString(),
119
                                                                           this.CastInfos.Chance.ToString(),
146
                                                                           this.CastInfos.Value3.ToString(),
120
                                                                           "",
147
                                                                           "",
121
                                                                           this.CastInfos.Duration.ToString(),
148
                                                                           this.CastInfos.Duration.ToString(),
122
                                                                           this.CastInfos.SpellId.ToString()));
149
                                                                           this.CastInfos.SpellId.ToString()));
123
                    break;
150
                    break;
124
 
151
 
125
                case EffectEnum.AddChatiment:                    
152
                case EffectEnum.Porter:
126
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
153
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
127
                                                                           this.Target.ActorId,
154
                                                                          this.Caster.ActorId,
128
                                                                           this.CastInfos.Value1.ToString(),
155
                                                                          this.CastInfos.Value1.ToString(),
129
                                                                           this.CastInfos.Value2.ToString(),
156
                                                                          "",
130
                                                                           this.CastInfos.Value3.ToString(),
157
                                                                          "",
131
                                                                           "",
158
                                                                          "",
132
                                                                           this.CastInfos.Duration.ToString(),
159
                                                                          this.CastInfos.Duration.ToString(),
133
                                                                           this.CastInfos.SpellId.ToString()));
160
                                                                          this.CastInfos.SpellId.ToString()));
134
                    break;
161
                    break;
135
 
162
 
136
                //case 98://Poison insidieux
 
 
137
                //case 107://Mot d'�pine (2�3), Contre(3)
 
 
138
                //case 100://Fl�che Empoisonn�e, Tout ou rien
 
 
139
                //case 108://Mot de R�g�n�ration, Tout ou rien
 
 
140
                //case 165://Ma�trises
 
 
141
                //    val = Integer.parseInt(args.split(";")[0]);
 
 
142
                //    String valMax1 = args.split(";")[1];
 
 
143
                //    if (valMax1.compareTo("-1") == 0 || spellID == 82 || spellID == 94)
 
 
144
                //    {
 
 
145
                //        SocketManager.GAME_SEND_FIGHT_GIE_TO_FIGHT(_fight, 7, id, getGUID(), val, "", "", "", duration, spellID);
 
 
146
                //    }
 
 
147
                //    else if (valMax1.compareTo("-1") != 0)
 
 
148
                //    {
 
 
149
                //        SocketManager.GAME_SEND_FIGHT_GIE_TO_FIGHT(_fight, 7, id, getGUID(), val, valMax1, "", "", duration, spellID);
 
 
150
                //    }
 
 
151
                //    break;
 
 
152
                default:
163
                default:
153
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
164
                    Target.Fight.SendToFight(new GameEffectInformationsMessage(this.CastInfos.EffectType,
154
                                                                               this.Target.ActorId,
165
                                                                               this.Target.ActorId,
...
 
...
 
189
 
200
 
190
            this.CastInfos.FakeValue = 0;
201
            this.CastInfos.FakeValue = 0;
191
 
202
 
192
            return this.Duration;
203
            return this.Duration;            
193
        }
204
        }
194
    }
205
    }
195
}
206
}
Show contents
Show contents
Show contents
78
18
        {
18
        {
19
            var TargetTeleport = new EffectCast(EffectEnum.Teleport, this.CastInfos.SpellId, this.CastInfos.Caster.CellId, 0, 0, 0, 0, 0, this.Target, null);
19
            var TargetTeleport = new EffectCast(EffectEnum.Teleport, this.CastInfos.SpellId, this.CastInfos.Caster.CellId, 0, 0, 0, 0, 0, this.Target, null);
20
            var CasterTeleport = new EffectCast(EffectEnum.Teleport, this.CastInfos.SpellId, this.Target.CellId, 0, 0, 0, 0, 0, this.CastInfos.Caster, null);
20
            var CasterTeleport = new EffectCast(EffectEnum.Teleport, this.CastInfos.SpellId, this.Target.CellId, 0, 0, 0, 0, 0, this.CastInfos.Caster, null);
21
                        
21
 
 
 
22
            this.Caster.SetCell(null);
 
 
23
            this.Target.SetCell(null);
 
 
24
 
22
            if (BuffSacrifice.Teleport.ApplyEffect(TargetTeleport) == -3)
25
            if (BuffSacrifice.Teleport.ApplyEffect(TargetTeleport) == -3)
23
                return -3;
26
                return -3;
24
 
27
 
...
 
...
 
25
            if (BuffSacrifice.Teleport.ApplyEffect(CasterTeleport) == -3)
28
            if (BuffSacrifice.Teleport.ApplyEffect(CasterTeleport) == -3)
26
                return -3;
29
                return -3;
27
 
30
 
28
            if (EffectDamage.ApplyDamages(DamageInfos, this.CastInfos.Caster, DamageValue) == -3)
31
            if (EffectDamage.ApplyDamages(DamageInfos, this.CastInfos.Caster, ref DamageValue) == -3)
29
                return -3;
32
                return -3;
30
 
33
 
31
            DamageValue = 0;
34
            DamageValue = 0;
78
19
        {
19
        {
20
            // On change le skin
20
            // On change le skin
21
            this.CastInfos.Value2 = this.Target.Skin;
21
            this.CastInfos.Value2 = this.Target.Skin;
22
            this.Target.Skin = this.CastInfos.Value3;
22
            this.Target.Skin = this.CastInfos.Value3 == -1 ? this.Target.Skin : this.CastInfos.Value3;
23
 
23
 
24
            this.Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.ChangeSkin, this.Caster.ActorId, this.Target.ActorId + "," +
this.CastInfos.Value2 + "," + this.Target.Skin + "," + this.Duration));
24
            this.Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.ChangeSkin, this.Caster.ActorId, this.Target.ActorId + "," +
this.CastInfos.Value2 + "," + this.Target.Skin + "," + this.Duration));
25
 
25
 
78
31
                    break;
31
                    break;
32
            }
32
            }
33
 
33
 
34
            this.Target.Fight.SendToFight(new GameActionMessage((int)this.CastInfos.EffectType, this.Target.ActorId, this.Target.ActorId + "," + ShowValue + "," + this.Duration));
34
            if(CastInfos.EffectType != EffectEnum.AddRenvoiDamage)
 
 
35
                this.Target.Fight.SendToFight(new GameActionMessage((int)this.CastInfos.EffectType, this.Target.ActorId, this.Target.ActorId + "," + ShowValue + "," + this.Duration));
35
 
36
 
36
            this.Target.Stats.AddBoost(this.CastInfos.EffectType, this.CastInfos.Value1);
37
            this.Target.Stats.AddBoost(this.CastInfos.EffectType, this.CastInfos.Value1);
37
 
38
 
Show contents
78
17
                        if (Target.Team != CastInfos.Caster.Team)
17
                        if (Target.Team != CastInfos.Caster.Team)
18
                            continue;
18
                            continue;
19
                        Target.Stats.AddBoost(EffectEnum.AddArmorFeu, CastInfos.Value1);
19
                        Target.Stats.AddBoost(EffectEnum.AddArmorFeu, CastInfos.Value1);
20
                        CastInfos.SubEffect = EffectEnum.AddArmorFeu;
 
 
21
                        break;
20
                        break;
22
 
21
 
23
                    case 6:
22
                    case 6:
...
 
...
 
24
                        if (Target.Team != CastInfos.Caster.Team)
23
                        if (Target.Team != CastInfos.Caster.Team)
25
                            continue;
24
                            continue;
26
                        Target.Stats.AddBoost(EffectEnum.AddArmorTerre, CastInfos.Value1);
25
                        Target.Stats.AddBoost(EffectEnum.AddArmorTerre, CastInfos.Value1);
27
                        CastInfos.SubEffect = EffectEnum.AddArmorTerre;
 
 
28
                        break;
26
                        break;
29
 
27
 
30
                    case 14:
28
                    case 14:
...
 
...
 
31
                        if (Target.Team != CastInfos.Caster.Team)
29
                        if (Target.Team != CastInfos.Caster.Team)
32
                            continue;
30
                            continue;
33
                        Target.Stats.AddBoost(EffectEnum.AddArmorAir, CastInfos.Value1);
31
                        Target.Stats.AddBoost(EffectEnum.AddArmorAir, CastInfos.Value1);
34
                        CastInfos.SubEffect = EffectEnum.AddArmorAir;
 
 
35
                        break;
32
                        break;
36
 
33
 
37
                    case 18:
34
                    case 18:
...
 
...
 
38
                        if (Target.Team != CastInfos.Caster.Team)
35
                        if (Target.Team != CastInfos.Caster.Team)
39
                            continue;
36
                            continue;
40
                        Target.Stats.AddBoost(EffectEnum.AddArmorEau, CastInfos.Value1);
37
                        Target.Stats.AddBoost(EffectEnum.AddArmorEau, CastInfos.Value1);
41
                        CastInfos.SubEffect = EffectEnum.AddArmorEau;
 
 
42
                        break;
38
                        break;
43
 
39
 
44
                    default:
40
                    default:
45
                        Target.Stats.AddBoost(EffectEnum.AddArmor, CastInfos.Value1);
41
                        Target.Stats.AddBoost(EffectEnum.AddArmor, CastInfos.Value1);
46
                        CastInfos.SubEffect = EffectEnum.AddArmor;
 
 
47
                        break;
42
                        break;
48
                }
43
                }
49
 
44
 
78
91
            { EffectEnum.AddEchecCritic        , new EffectStats()     },
91
            { EffectEnum.AddEchecCritic        , new EffectStats()     },
92
            { EffectEnum.AddDamageCritic       , new EffectStats()     },
92
            { EffectEnum.AddDamageCritic       , new EffectStats()     },
93
            { EffectEnum.AddDamagePercent      , new EffectStats()     },
93
            { EffectEnum.AddDamagePercent      , new EffectStats()     },
 
 
94
            { EffectEnum.SubDamagePercent      , new EffectStats()     },
94
            { EffectEnum.SubDamage             , new EffectStats()     },
95
            { EffectEnum.SubDamage             , new EffectStats()     },
95
            { EffectEnum.SubDamageCritic       , new EffectStats()     },
96
            { EffectEnum.SubDamageCritic       , new EffectStats()     },
 
 
97
            { EffectEnum.AddRenvoiDamage       , new EffectStats()     },
96
 
98
 
97
            // Chatiment sacris
99
            // Chatiment sacris
98
            { EffectEnum.AddChatiment          , new EffectChatiment() },
100
            { EffectEnum.AddChatiment          , new EffectChatiment() },
...
 
...
 
103
 
105
 
104
            // Ajout d'un etat / changement de skin
106
            // Ajout d'un etat / changement de skin
105
            { EffectEnum.ChangeSkin            , new EffectSkin()      },
107
            { EffectEnum.ChangeSkin            , new EffectSkin()      },
106
            { EffectEnum.AddState              , new EffectState()     },
108
            { EffectEnum.AddState              , new EffectAddState()     },
107
            { EffectEnum.Invisible             , new EffectState()     },
109
            { EffectEnum.Invisible             , new EffectAddState()     },
108
 
110
 
109
            // Vol de statistique
111
            // Vol de statistique
110
            { EffectEnum.VolForce              , new EffectStatsSteal()},
112
            { EffectEnum.VolForce              , new EffectStatsSteal()},
...
 
...
 
118
 
120
 
119
            // Sacrifice
121
            // Sacrifice
120
            { EffectEnum.Sacrifice             , new EffectSacrifice() },
122
            { EffectEnum.Sacrifice             , new EffectSacrifice() },
 
 
123
            { EffectEnum.Transpose             , new EffectTranspose() },            
 
 
124
 
 
 
125
            // Derobade
 
 
126
            { EffectEnum.MissBack              , new EffectDerobade()  },
 
 
127
 
 
 
128
            // Augmente de X les domamges de base du sort Y
 
 
129
            { EffectEnum.IncreaseSpellDamage   , new EffectIncreaseSpellJetDamage()},
 
 
130
 
 
 
131
            // Chance Ecaflip
 
 
132
            { EffectEnum.ChanceEcaflip         , new EffectChanceEcaflip()},
 
 
133
 
 
 
134
            // Debuff
 
 
135
            { EffectEnum.DeleteAllBonus        , new EffectDebuff()    },
 
 
136
 
 
 
137
            // Perte etat
 
 
138
            { EffectEnum.LostState             , new EffectLostState() },
 
 
139
 
 
 
140
            // Panda
 
 
141
            { EffectEnum.Porter                , new EffectPorter()    },
 
 
142
            { EffectEnum.Lancer                , new EffectLancer()    },
121
        };
143
        };
122
 
144
 
123
        /// <summary>
145
        /// <summary>
78
71
            set;
71
            set;
72
        }
72
        }
73
 
73
 
 
 
74
        public bool IsCAC
 
 
75
        {
 
 
76
            get;
 
 
77
            set;
 
 
78
        }
 
 
79
 
74
        public bool IsTrap
80
        public bool IsTrap
75
        {
81
        {
76
            get;
82
            get;
...
 
...
 
139
            set;
145
            set;
140
        }
146
        }
141
 
147
 
142
        public EffectCast(EffectEnum EffectType, int SpellId, int CellId, int Value1, int Value2, int Value3, int Chance, int Duration, Fighter Caster,
List<Fighter> Targets, EffectEnum SubEffect = EffectEnum.None, int DamageValue = 0)
148
        public EffectCast(EffectEnum EffectType, int SpellId, int CellId, int Value1, int Value2, int Value3, int Chance, int Duration, Fighter Caster, List<Fighter> Targets, bool IsCAC = false, EffectEnum SubEffect = EffectEnum.None, int DamageValue = 0)
143
        {
149
        {
144
            this.EffectType = EffectType;
150
            this.EffectType = EffectType;
145
            this.SpellId = SpellId;
151
            this.SpellId = SpellId;
...
 
...
 
153
            this.Targets = Targets;
159
            this.Targets = Targets;
154
            this.SubEffect = SubEffect;
160
            this.SubEffect = SubEffect;
155
            this.DamageValue = DamageValue;
161
            this.DamageValue = DamageValue;
 
 
162
            this.IsCAC = IsCAC;
156
        }
163
        }
157
    }
164
    }
158
}
165
}
Show contents
78
18
            {
18
            {
19
                // L'effet est un poison
19
                // L'effet est un poison
20
                CastInfos.IsPoison = true;
20
                CastInfos.IsPoison = true;
 
 
21
 
 
 
22
                foreach (var Target in CastInfos.Targets)
 
 
23
                {
 
 
24
                    Target.Buffs.AddBuff(new BuffDamage(CastInfos, Target));
 
 
25
                }
21
            }
26
            }
22
            else // Dommage direct
27
            else // Dommage direct
23
            {
28
            {
...
 
...
 
43
        {
48
        {
44
            var Caster = CastInfos.Caster;
49
            var Caster = CastInfos.Caster;
45
 
50
 
 
 
51
            // Perd l'invisibilité s'il frappe directement
 
 
52
            if (!CastInfos.IsPoison && !CastInfos.IsTrap && !CastInfos.IsReflect)
 
 
53
                Caster.States.RemoveState(FighterStateEnum.STATE_INVISIBLE);
 
 
54
 
46
            // Recalcul du jet chez le lanceur et la cible
55
            // Recalcul du jet chez le lanceur et la cible
47
            if (Caster.Buffs.OnAttackPostJet(CastInfos, ref DamageJet) == -3) return -3;
56
            if (!CastInfos.IsPoison && !CastInfos.IsReflect)
48
            if (Target.Buffs.OnAttackedPostJet(CastInfos, ref DamageJet) == -3) return -3;
57
            {
 
 
58
                if (Caster.Buffs.OnAttackPostJet(CastInfos, ref DamageJet) == -3) return -3;
 
 
59
                if (Target.Buffs.OnAttackedPostJet(CastInfos, ref DamageJet) == -3) return -3;
 
 
60
            }
49
 
61
 
50
            // Calcul jet
62
            // Calcul jet
51
            Caster.CalculDamages(CastInfos.EffectType, ref DamageJet);
63
            Caster.CalculDamages(CastInfos.EffectType, ref DamageJet);
...
 
...
 
52
            // Calcul resistances
64
            // Calcul resistances
53
            Target.CalculReduceDamages(CastInfos.EffectType, ref DamageJet);
65
            Target.CalculReduceDamages(CastInfos.EffectType, ref DamageJet);
54
 
66
 
 
 
67
            if (DamageJet > 0)
 
 
68
            {
 
 
69
                // Armure ?
 
 
70
                if (!CastInfos.IsPoison && !CastInfos.IsReflect)
 
 
71
                {
 
 
72
                    // Recuperation armure par effet
 
 
73
                    var Armor = Target.CalculArmor(CastInfos.EffectType);
 
 
74
 
 
 
75
                    // Aucune armure
 
 
76
                    if (Armor != 0)
 
 
77
                    {
 
 
78
                        // Reduction des dommages
 
 
79
                        Target.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_ARMOR, Target.ActorId, Target.ActorId + "," +
Armor));
 
 
80
 
 
 
81
                        DamageJet -= Armor;
 
 
82
 
 
 
83
                        if (DamageJet < 0) DamageJet = 0;
 
 
84
                    }
 
 
85
                }
 
 
86
            }
 
 
87
 
55
            // Recalcul chez le lanceur et la cible
88
            // Recalcul chez le lanceur et la cible
56
            if (Caster.Buffs.OnAttackAfterJet(CastInfos, ref DamageJet) == -3) return -3;
89
            if (!CastInfos.IsPoison && !CastInfos.IsReflect)
57
            if (Target.Buffs.OnAttackedAfterJet(CastInfos, ref DamageJet) == -3) return -3;
90
            {
 
 
91
                if (Caster.Buffs.OnAttackAfterJet(CastInfos, ref DamageJet) == -3) return -3;
 
 
92
                if (Target.Buffs.OnAttackedAfterJet(CastInfos, ref DamageJet) == -3) return -3;
 
 
93
            }
58
 
94
 
59
            // TODO Renvoie de dommages et armure ?
95
            // S'il subit des dommages
 
 
96
            if (DamageJet > 0)
 
 
97
            {
 
 
98
                // Si c'est pas un poison ou un renvoi on applique le renvoie
 
 
99
                if (!CastInfos.IsPoison && !CastInfos.IsReflect)
 
 
100
                {
 
 
101
                    var ReflectDamage = Target.ReflectDamage;
60
 
102
 
 
 
103
                    // Si du renvoi
 
 
104
                    if (ReflectDamage > 0)
 
 
105
                    {
 
 
106
                        Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.AddRenvoiDamage, Target.ActorId, Target.ActorId + "," +
ReflectDamage));
 
 
107
 
 
 
108
                        // Trop de renvois
 
 
109
                        if (ReflectDamage > DamageJet) ReflectDamage = DamageJet;
 
 
110
 
 
 
111
                        var SubInfos = new EffectCast(EffectEnum.DamageBrut, 0, 0, 0, 0, 0, 0, 0, Target, null);
 
 
112
                        SubInfos.IsReflect = true;
 
 
113
 
 
 
114
                        if (EffectDamage.ApplyDamages(SubInfos, Caster, ref ReflectDamage) == -3)
 
 
115
                            return -3;
 
 
116
 
 
 
117
                        DamageJet -= ReflectDamage;
 
 
118
                    }
 
 
119
                }
 
 
120
            }
 
 
121
 
 
 
122
            // Peu pas etre en dessous de 0
 
 
123
            if (DamageJet < 0) DamageJet = 0;
 
 
124
 
61
            // Dommages superieur a la vie de la cible
125
            // Dommages superieur a la vie de la cible
62
            if (DamageJet > Target.Life)
126
            if (DamageJet > Target.Life)
63
                DamageJet = Target.Life;
127
                DamageJet = Target.Life;
Show contents
Show contents
Show contents
Show contents
Show contents
Show contents
78
116
 
116
 
117
            Target.Fight.SendToFight(new GameActionMessage(GameAction, Target.ActorId, Target.ActorId + "," + LastCell.Id));
117
            Target.Fight.SendToFight(new GameActionMessage(GameAction, Target.ActorId, Target.ActorId + "," + LastCell.Id));
118
 
118
 
119
            System.Threading.Thread.Sleep(Length * 200);
119
            if(Length > 0)
 
 
120
                System.Threading.Thread.Sleep(Length * 200);
120
 
121
 
121
            // Affecte la cell
122
            // Affecte la cell
122
            return Target.SetCell(LastCell);
123
            return Target.SetCell(LastCell);
...
 
...
 
131
 
132
 
132
            var SubInfos = new EffectCast(EffectEnum.DamageBrut, CastInfos.SpellId, CastInfos.CellId, 0, 0, 0, 0, 0, CastInfos.Caster, null);
133
            var SubInfos = new EffectCast(EffectEnum.DamageBrut, CastInfos.SpellId, CastInfos.CellId, 0, 0, 0, 0, 0, CastInfos.Caster, null);
133
 
134
 
134
            return EffectDamage.ApplyDamages(SubInfos, Target, DamageValue);
135
            return EffectDamage.ApplyDamages(SubInfos, Target, ref DamageValue);
135
        }
136
        }
136
    }
137
    }
137
}
138
}
78
11
        {
11
        {
12
            foreach (var Target in CastInfos.Targets)
12
            foreach (var Target in CastInfos.Targets)
13
            {
13
            {
14
                if (Target.Team != CastInfos.Caster.Team && Target != CastInfos.Caster)
14
                if (Target.Team != CastInfos.Caster.Team || Target == CastInfos.Caster)
15
                    continue;
15
                    continue;
16
 
16
 
17
                Target.Buffs.AddBuff(new BuffSacrifice(CastInfos, Target));
17
                Target.Buffs.AddBuff(new BuffSacrifice(CastInfos, Target));
78
9
    {
9
    {
10
        public override int ApplyEffect(EffectCast CastInfos)
10
        public override int ApplyEffect(EffectCast CastInfos)
11
        {
11
        {
12
            foreach (var Target in CastInfos.Targets)
12
            if (CastInfos.Duration > 0)
13
            {
13
            {
14
                Target.Buffs.AddBuff(new BuffSkin(CastInfos, Target));
14
                foreach (var Target in CastInfos.Targets)
 
 
15
                {
 
 
16
                    Target.Buffs.AddBuff(new BuffSkin(CastInfos, Target));
 
 
17
                }
15
            }
18
            }
16
 
19
 
17
            return -1;
20
            return -1;
78
11
        {
11
        {
12
            foreach (var Target in CastInfos.Targets)
12
            foreach (var Target in CastInfos.Targets)
13
            {
13
            {
14
                var SubInfos = new EffectCast(CastInfos.EffectType, CastInfos.SpellId, CastInfos.CellId, CastInfos.RandomJet, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Targets, CastInfos.SubEffect, CastInfos.DamageValue);
14
                var SubInfos = new EffectCast(CastInfos.EffectType, CastInfos.SpellId, CastInfos.CellId, CastInfos.RandomJet, CastInfos.Value2,
CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Targets);
15
                var BuffStats = new BuffStats(SubInfos, Target);
15
                var BuffStats = new BuffStats(SubInfos, Target);
16
                var DamageValue = 0;
16
                var DamageValue = 0;
17
                if (BuffStats.ApplyEffect(ref DamageValue) == -3)
17
                if (BuffStats.ApplyEffect(ref DamageValue) == -3)
78
36
            var MalusType = TargetMalus[CastInfos.EffectType];
36
            var MalusType = TargetMalus[CastInfos.EffectType];
37
            var BonusType = CasterBonus[CastInfos.EffectType];
37
            var BonusType = CasterBonus[CastInfos.EffectType];
38
 
38
 
39
            var MalusInfos = new EffectCast(MalusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Targets, CastInfos.SubEffect, CastInfos.DamageValue);
39
            var MalusInfos = new EffectCast(MalusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3,
CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Targets);
40
            var BonusInfos = new EffectCast(BonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Targets, CastInfos.SubEffect, CastInfos.DamageValue);
40
            var BonusInfos = new EffectCast(BonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3,
CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Targets);
41
            var DamageValue = 0;
41
            var DamageValue = 0;
42
 
42
 
43
            foreach (var Target in CastInfos.Targets)
43
            foreach (var Target in CastInfos.Targets)
Show contents
78
106
        private event GenericWorldClientPacket Event_SendToFight;        
106
        private event GenericWorldClientPacket Event_SendToFight;        
107
 
107
 
108
        [MethodImpl(MethodImplOptions.Synchronized)]
108
        [MethodImpl(MethodImplOptions.Synchronized)]
109
        public abstract void EndFight(FightTeam Loosers);
109
        public abstract void EndFight(FightTeam Winners, FightTeam Loosers);
110
        public abstract int GetStartTimer();
110
        public abstract int GetStartTimer();
111
        public abstract int GetTurnTime();
111
        public abstract int GetTurnTime();
 
 
112
        public abstract void SerializeAs_FlagDisplayInformations(StringBuilder Packet);   
112
 
113
 
113
        public void SerializeAs_FlagDisplayInformations(StringBuilder Packet)
 
 
114
        {
 
 
115
            Packet.Append(this.FightId).Append(';');
 
 
116
            Packet.Append((int)this.FightType).Append('|');
 
 
117
            Packet.Append(this.myTeam1.LeaderId).Append(';');
 
 
118
            Packet.Append(this.myTeam1.Leader.MapCell).Append(';');
 
 
119
            Packet.Append(this.myTeam1.Leader.ActorType == GameActorTypeEnum.TYPE_CHARACTER ? '0' : '1').Append(';');
 
 
120
            Packet.Append(this.FightType == FightType.TYPE_AGGRESSION ? (this.myTeam1.Leader as CharacterFighter).Character.Alignment.AlignmentId : -1).Append('|');
 
 
121
            Packet.Append(this.myTeam2.LeaderId).Append(';');
 
 
122
            Packet.Append(this.myTeam2.Leader.MapCell).Append(';');
 
 
123
            Packet.Append(this.myTeam2.Leader.ActorType == GameActorTypeEnum.TYPE_CHARACTER ? '0' : '1').Append(';');
 
 
124
            Packet.Append(this.FightType == FightType.TYPE_AGGRESSION ? (this.myTeam2.Leader as CharacterFighter).Character.Alignment.AlignmentId : -1);
 
 
125
        }
 
 
126
 
114
 
127
        public int FightId
115
        public int FightId
128
        {
116
        {
...
 
...
 
168
            }
156
            }
169
        }
157
        }
170
 
158
 
 
 
159
        public int NextActorId
 
 
160
        {
 
 
161
            get
 
 
162
            {
 
 
163
                return this.myNextActorId--;
 
 
164
            }
 
 
165
        }
 
 
166
 
171
        // Liste des cells dispo par equipes
167
        // Liste des cells dispo par equipes
172
        protected ChatChannel myChatChannel = new ChatChannel(ChatChannelEnum.CHANNEL_GENERAL);
168
        protected ChatChannel myChatChannel = new ChatChannel(ChatChannelEnum.CHANNEL_GENERAL);
173
        protected Dictionary<FightTeam, Dictionary<int, FightCell>> myFightCells = new Dictionary<FightTeam, Dictionary<int,
FightCell>>();
169
        protected Dictionary<FightTeam, Dictionary<int, FightCell>> myFightCells = new Dictionary<FightTeam, Dictionary<int,
FightCell>>();
...
 
...
 
178
        protected FightTeam myTeam2 = new FightTeam(1);
174
        protected FightTeam myTeam2 = new FightTeam(1);
179
        protected int myLoopTimeOut = -1;
175
        protected int myLoopTimeOut = -1;
180
        protected int myLoopActionTimeOut;
176
        protected int myLoopActionTimeOut;
 
 
177
        protected int myNextActorId = -1;
181
        protected GameFightEndResult myResult;
178
        protected GameFightEndResult myResult;
182
        protected List<GameAction> myActions = new List<GameAction>();
179
        protected List<GameAction> myActions = new List<GameAction>();
183
 
180
 
...
 
...
 
214
            if (Fight.MAP_FIGHTCELLS.ContainsKey(this.Map.MAP_ID))
211
            if (Fight.MAP_FIGHTCELLS.ContainsKey(this.Map.MAP_ID))
215
            {
212
            {
216
                // Ajout
213
                // Ajout
217
                foreach (var Cell in Fight.MAP_FIGHTCELLS[this.Map.MAP_ID][0])
214
                lock (Fight.MAP_FIGHTCELLS)
218
                    this.myFightCells[this.myTeam1].Add(Cell, this.myCells[Cell]);
215
                {
219
                foreach (var Cell in Fight.MAP_FIGHTCELLS[this.Map.MAP_ID][1])
216
                    foreach (var Cell in Fight.MAP_FIGHTCELLS[this.Map.MAP_ID][0])
220
                    this.myFightCells[this.myTeam2].Add(Cell, this.myCells[Cell]);
217
                        this.myFightCells[this.myTeam1].Add(Cell, this.myCells[Cell]);
 
 
218
                    foreach (var Cell in Fight.MAP_FIGHTCELLS[this.Map.MAP_ID][1])
 
 
219
                        this.myFightCells[this.myTeam2].Add(Cell, this.myCells[Cell]);
 
 
220
                }
221
            }
221
            }
222
            else
222
            else
223
            {
223
            {
...
 
...
 
233
                    {
233
                    {
234
                        this.myFightCells[this.myTeam2].Add(Algo.CellCharCodeToId(Data[1].Substring(i, 2)),
this.myCells[Algo.CellCharCodeToId(Data[1].Substring(i, 2))]);
234
                        this.myFightCells[this.myTeam2].Add(Algo.CellCharCodeToId(Data[1].Substring(i, 2)),
this.myCells[Algo.CellCharCodeToId(Data[1].Substring(i, 2))]);
235
                    }
235
                    }
 
 
236
 
 
 
237
                    lock (Fight.MAP_FIGHTCELLS)
 
 
238
                    {
 
 
239
                        Fight.MAP_FIGHTCELLS.Add(this.Map.MAP_ID, new Dictionary<int, List<int>>());
 
 
240
                        Fight.MAP_FIGHTCELLS[this.Map.MAP_ID].Add(0, this.myFightCells[this.myTeam1].Select(x => x.Key).ToList());
 
 
241
                        Fight.MAP_FIGHTCELLS[this.Map.MAP_ID].Add(1, this.myFightCells[this.myTeam2].Select(x => x.Key).ToList());
 
 
242
                    }
236
                }
243
                }
237
                else
244
                else
238
                {
245
                {
...
 
...
 
454
                                }
461
                                }
455
 
462
 
456
                                // Fin du combat
463
                                // Fin du combat
457
                                this.EndFight(this.GetEnnemyTeam(Fighter.Team));
464
                                this.EndFight(this.GetEnnemyTeam(Fighter.Team), Fighter.Team);
458
                            }
465
                            }
459
                            else
466
                            else
460
                            {
467
                            {
...
 
...
 
470
                                // On envois
477
                                // On envois
471
                                Fighter.Send(new GameLeaveMessage());
478
                                Fighter.Send(new GameLeaveMessage());
472
                            }
479
                            }
473
                            break;
480
                            break;                        
474
                    }                    
481
                    }                    
475
                    break;
482
                    break;
476
 
483
 
...
 
...
 
492
                                if (this.CurrentFighter == Fighter)
499
                                if (this.CurrentFighter == Fighter)
493
                                    this.FightLoopState = FightLoopState.STATE_END_TURN;
500
                                    this.FightLoopState = FightLoopState.STATE_END_TURN;
494
                            }
501
                            }
495
                            break;                            
502
                            break;
 
 
503
                            
 
 
504
                        case Fights.FightType.TYPE_PVM:
 
 
505
                            // Si combat pas finis
 
 
506
                            if (Fighter.TryDie(Fighter.ActorId, true) != -3)
 
 
507
                            {
 
 
508
                                // Le combattant quitte le combat
 
 
509
                                Fighter.LeaveFight();
 
 
510
 
 
 
511
                                // On envois
 
 
512
                                Fighter.Send(new GameLeaveMessage());
 
 
513
 
 
 
514
                                // On passe le tour du joueur
 
 
515
                                if (this.CurrentFighter == Fighter)
 
 
516
                                    this.FightLoopState = FightLoopState.STATE_END_TURN;
 
 
517
                            }
 
 
518
                            break;
496
                    }
519
                    }
497
                    break;
520
                    break;
498
            }
521
            }
...
 
...
 
536
            // En attente de lancement
559
            // En attente de lancement
537
            this.FightLoopState = Fights.FightLoopState.STATE_WAIT_START;
560
            this.FightLoopState = Fights.FightLoopState.STATE_WAIT_START;
538
 
561
 
539
            // Lancement du gameLoop
562
            // Lancement du gameLoop 10 ms d'interval.
540
            this.StartTimer("GameLoop", this.GameLoop, 10, 10); // Loop infinis
563
            this.StartTimer("GameLoop", this.GameLoop, 10, 10);
541
        }
564
        }
542
 
565
 
543
        /// <summary>
566
        /// <summary>
...
 
...
 
558
                        this.BeginTurn();
581
                        this.BeginTurn();
559
                        break;
582
                        break;
560
 
583
 
561
                    case FightLoopState.STATE_WAIT_TURN: // Fin du combat par force
584
                    case FightLoopState.STATE_WAIT_TURN: // Fin du tour par force
562
                        if (this.myLoopTimeOut < Environment.TickCount)
585
                        if (this.myLoopTimeOut < Environment.TickCount)
563
                        {
586
                        {
564
                            if (this.IsActionsFinish() || this.myLoopActionTimeOut < Environment.TickCount)
587
                            if (this.IsActionsFinish() || this.myLoopActionTimeOut < Environment.TickCount)
...
 
...
 
593
                        if (this.IsActionsFinish() ||this.myLoopActionTimeOut < Environment.TickCount)
616
                        if (this.IsActionsFinish() ||this.myLoopActionTimeOut < Environment.TickCount)
594
                        {
617
                        {
595
                            this.EndTurn();
618
                            this.EndTurn();
596
                            this.EndFight(this.GetWinners());
619
                            this.EndFight(this.GetWinners(), this.GetEnnemyTeam(this.GetWinners()));
597
                        }
620
                        }
598
                        break;
621
                        break;
599
                }
622
                }
...
 
...
 
627
            var TacledChance = Pathfinder.TryTacle(Fighter);
650
            var TacledChance = Pathfinder.TryTacle(Fighter);
628
 
651
 
629
            // Si tacle
652
            // Si tacle
630
            if (TacledChance != -1)
653
            if (TacledChance != -1 && !this.CurrentFighter.States.HasState(FighterStateEnum.STATE_ENRACINER))
631
            {
654
            {
632
                // XX A été taclé
655
                // XX A été taclé
633
                this.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_TACLE, Fighter.ActorId));
656
                this.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_TACLE, Fighter.ActorId));
...
 
...
 
758
                    {
781
                    {
759
                        var FightCell = this.GetCell(Cell);
782
                        var FightCell = this.GetCell(Cell);
760
                        if(FightCell != null)
783
                        if(FightCell != null)
761
                            if (FightCell.HasGameObject(FightObjectType.OBJECT_FIGHTER))
784
                            if (FightCell.HasGameObject(FightObjectType.OBJECT_FIGHTER) | FightCell.HasGameObject(FightObjectType.OBJECT_CAWOTTE))
762
                                Targets[Effect].Add(FightCell.GetFighter());
785
                                Targets[Effect].AddRange(FightCell.GetObjects<Fighter>());
763
                    }
786
                    }
764
                }
787
                }
765
 
788
 
 
 
789
                var ActualChance = 0;
766
                foreach (var Effect in Effects)
790
                foreach (var Effect in Effects)
767
                {
791
                {
 
 
792
                    if (Effect.Chance > 0)
 
 
793
                    {
 
 
794
                        if(Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance))
 
 
795
                        {
 
 
796
                            ActualChance += Effect.Chance;
 
 
797
                            continue;
 
 
798
                        }
 
 
799
                        ActualChance -= 100;
 
 
800
                    }
 
 
801
 
 
 
802
                    // Actualisation des morts
 
 
803
                    Targets[Effect].RemoveAll(F => F.Dead);
 
 
804
 
768
                    var CastInfos = new EffectCast(Effect.EffectType, SpellLevel.SPELL_ID, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance,
Effect.Duration, Fighter, Targets[Effect]);
805
                    var CastInfos = new EffectCast(Effect.EffectType, SpellLevel.SPELL_ID, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance,
Effect.Duration, Fighter, Targets[Effect]);
769
 
806
                    
770
                    if (EffectBase.TryApplyEffect(CastInfos) == -3)
807
                    if (EffectBase.TryApplyEffect(CastInfos) == -3)
771
                        goto StopAction;
808
                         break;
772
                }                                             
809
                }                                             
773
            }
810
            }
774
 
811
 
775
        StopAction:
 
 
776
 
 
 
777
            this.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_LOSTPA, Fighter.ActorId, Fighter.ActorId + ",-" +
SpellLevel.APCost.ToString()));
812
            this.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_LOSTPA, Fighter.ActorId, Fighter.ActorId + ",-" +
SpellLevel.APCost.ToString()));
778
 
813
 
779
            if(this.FightLoopState != Fights.FightLoopState.STATE_END_FIGHT)
814
            if(this.FightLoopState != Fights.FightLoopState.STATE_END_FIGHT)
...
 
...
 
786
        /// </summary>
821
        /// </summary>
787
        /// <param name="Actor"></param>
822
        /// <param name="Actor"></param>
788
        /// <param name="NewCell"></param>
823
        /// <param name="NewCell"></param>
 
 
824
        [MethodImpl(MethodImplOptions.Synchronized)]
789
        public void ActorMoved(MovementPath Path, IGameActor Actor, int NewCell)
825
        public void ActorMoved(MovementPath Path, IGameActor Actor, int NewCell)
790
        {
826
        {
791
            var Fighter = Actor as Fighter;
827
            var Fighter = Actor as Fighter;
...
 
...
 
826
 
862
 
827
            // Envois debut du tour
863
            // Envois debut du tour
828
            this.SendToFight(new GameTurnStartMessage(this.CurrentFighter.ActorId, this.GetTurnTime()));
864
            this.SendToFight(new GameTurnStartMessage(this.CurrentFighter.ActorId, this.GetTurnTime()));
 
 
865
 
 
 
866
            // Monstre passe le tour
 
 
867
            if (this.CurrentFighter.ActorType == GameActorTypeEnum.TYPE_MONSTER)
 
 
868
                this.FightLoopState = Fights.FightLoopState.STATE_END_TURN;
829
        }
869
        }
830
 
870
 
831
        /// <summary>
871
        /// <summary>
...
 
...
 
907
        /// </summary>
947
        /// </summary>
908
        [MethodImpl(MethodImplOptions.Synchronized)]
948
        [MethodImpl(MethodImplOptions.Synchronized)]
909
        protected void EndFight()
949
        protected void EndFight()
910
        {
950
        {            
 
 
951
            switch (this.FightState)
 
 
952
            {
 
 
953
                case FightState.STATE_PLACEMENT:
 
 
954
                    this.Map.SendToMap(new GameFightFlagDestroyMessage(this.FightId));
 
 
955
                    break;
 
 
956
 
 
 
957
                case Fights.FightState.STATE_ENDED:
 
 
958
                    return;
 
 
959
            }
 
 
960
 
911
            this.StopTimer("GameLoop");
961
            this.StopTimer("GameLoop");
912
 
962
 
913
            this.SendToFight(new GameFightEndMessage(this.myResult));
963
            this.SendToFight(new GameFightEndMessage(this.myResult));
...
 
...
 
929
            this.myWorker = null;
979
            this.myWorker = null;
930
            this.myTimers = null;
980
            this.myTimers = null;
931
 
981
 
932
            this.Map.RemoveFight(this);
982
            this.Map.RemoveFight(this);            
 
 
983
 
 
 
984
            this.FightState = Fights.FightState.STATE_ENDED;
 
 
985
            this.FightLoopState = FightLoopState.STATE_END_FIGHT;
933
        }
986
        }
934
 
987
 
935
        #region SubMethods            
988
        #region SubMethods            
78
11
        private bool myWalkable;
11
        private bool myWalkable;
12
        private bool myLineOfSight;
12
        private bool myLineOfSight;
13
 
13
 
14
        private List<Fighter> myFighters = new List<Fighter>();
14
        private List<IFightObject> myFightObjects = new List<IFightObject>();
15
        // TODO Liste all des GameObjects
15
 
16
 
 
 
17
        public FightCell(int Id, bool walk, bool los)
16
        public FightCell(int Id, bool walk, bool los)
18
        {
17
        {
19
            this.Id = Id;
18
            this.Id = Id;
...
 
...
 
33
 
32
 
34
        public bool HasGameObject(FightObjectType ObjectType)
33
        public bool HasGameObject(FightObjectType ObjectType)
35
        {
34
        {
36
            switch (ObjectType)
35
            return myFightObjects.Any(x => x.ObjectType == ObjectType);
37
            {
 
 
38
                case FightObjectType.OBJECT_CAWOTTE:
 
 
39
                    return false;
 
 
40
 
 
 
41
                case FightObjectType.OBJECT_GLYPHE:
 
 
42
                    return false;
 
 
43
 
 
 
44
                case FightObjectType.OBJECT_FIGHTER:
 
 
45
                    return this.myFighters.Count > 0;
 
 
46
                    
 
 
47
                default:
 
 
48
                    return false;
 
 
49
            }
 
 
50
        }
36
        }
51
 
37
 
52
        public Fighter GetFighter()
38
        public List<T> GetObjects<T>() where T : IFightObject
53
        {
39
        {
54
            return this.myFighters[0];
40
            return this.myFightObjects.OfType<T>().ToList();
55
        }
41
        }
56
 
42
 
57
        public Fighter HasEnnemy(FightTeam Team)
43
        public Fighter HasEnnemy(FightTeam Team)
58
        {
44
        {
59
            if (!this.HasGameObject(FightObjectType.OBJECT_FIGHTER))
45
            if (!this.HasGameObject(FightObjectType.OBJECT_FIGHTER) && !this.HasGameObject(FightObjectType.OBJECT_CAWOTTE))
60
                return null;
46
                return null;
61
 
47
 
62
            return this.myFighters[0].Team != Team ? this.myFighters[0] : null;
48
            return this.GetObjects<Fighter>()[0].Team != Team ? this.GetObjects<Fighter>()[0] : null;
63
        }
49
        }
64
 
50
 
65
        public int AddFighter(Fighter Fighter)
51
        public int AddObject(IFightObject Object)
66
        {
52
        {
67
            this.myFighters.Add(Fighter);
53
            this.myFightObjects.Add(Object);
68
 
54
 
69
            // TODO ACTIVE FIGHTOBJECT TRAP ETC ...
55
            // TODO ACTIVE FIGHTOBJECT TRAP ETC ...
 
 
56
 
70
            return -1;
57
            return -1;
71
        }
58
        }
72
 
59
 
73
        public void RemoveFighter(Fighter Fighter)
60
        public void RemoveObject(IFightObject Object)
74
        {
61
        {
75
            this.myFighters.Remove(Fighter);
62
            this.myFightObjects.Remove(Object);
76
        }
63
        }
77
    }
64
    }
78
}
65
}
78
77
            set;
77
            set;
78
        }
78
        }
79
 
79
 
 
 
80
        public int ReflectDamage
 
 
81
        {
 
 
82
            get
 
 
83
            {
 
 
84
                return  ((1 + (this.Stats.GetTotal(EffectEnum.AddSagesse) / 100)) * this.Stats.GetTotal(EffectEnum.AddRenvoiDamage)) +
this.Stats.GetTotal(EffectEnum.AddRenvoiDamageItem);
 
 
85
            }
 
 
86
        }
 
 
87
 
80
        public int MaxLife
88
        public int MaxLife
81
        {
89
        {
82
            get
90
            get
...
 
...
 
115
            }
123
            }
116
            set
124
            set
117
            {
125
            {
118
                this.CurrentLife = value;
126
                this.CurrentLife = value - this.Stats.GetTotal(EffectEnum.AddVitalite) + this.Stats.GetTotal(EffectEnum.AddVie);
119
            }
127
            }
120
        }
128
        }
121
 
129
 
...
 
...
 
198
            set;
206
            set;
199
        }
207
        }
200
 
208
 
 
 
209
        public int SkinSize
 
 
210
        {
 
 
211
            get;
 
 
212
            set;
 
 
213
        }
 
 
214
 
201
        public GenericStats Stats
215
        public GenericStats Stats
202
        {
216
        {
203
            get;
217
            get;
...
 
...
 
260
        /// Contructeur unique, type de l'entitée
274
        /// Contructeur unique, type de l'entitée
261
        /// </summary>
275
        /// </summary>
262
        /// <param name="ActorType"></param>
276
        /// <param name="ActorType"></param>
263
        public Fighter(GameActorTypeEnum ActorType, Fight Fight)
277
        public Fighter(Fight Fight, GameActorTypeEnum ActorType)
264
        {
278
        {
265
            this.ActorType = ActorType;
279
            this.ActorType = ActorType;
266
            this.Fight = Fight;
280
            this.Fight = Fight;
267
            this.Buffs = new FighterBuff();
281
            this.Buffs = new FighterBuff();
268
            this.States = new FighterState();
282
            this.States = new FighterState(this);
269
            this.SpellsController = new FighterSpell();
283
            this.SpellsController = new FighterSpell();
270
        }
284
        }
271
 
285
 
...
 
...
 
277
        public int SetCell(FightCell Cell)
291
        public int SetCell(FightCell Cell)
278
        {
292
        {
279
            if (this.myCell != null)
293
            if (this.myCell != null)
280
                this.myCell.RemoveFighter(this); // On vire le fighter de la cell:
294
                this.myCell.RemoveObject(this); // On vire le fighter de la cell:
281
 
295
 
282
            this.myCell = Cell;
296
            this.myCell = Cell;
283
 
297
 
284
            if (this.myCell.AddFighter(this) == -3)
298
            if (this.myCell != null)
285
                return -3;
299
            {
 
 
300
                // Ajout du combattant sur la cell
 
 
301
                if (this.myCell.AddObject(this) == -3)
 
 
302
                    return-3;
286
 
303
 
287
            if (this.Buffs.EndMove() == -3)
304
                if (this.Buffs.EndMove() == -3)
288
                return -3;
305
                    return -3;                
 
 
306
            }
289
 
307
 
290
            return -1;
308
            return -1;
291
        }
309
        }
...
 
...
 
295
        /// </summary>
313
        /// </summary>
296
        /// <param name="StatsToMerge"></param>
314
        /// <param name="StatsToMerge"></param>
297
        /// <param name="ActorId"></param>
315
        /// <param name="ActorId"></param>
298
        protected void InitFighter(GenericStats StatsToMerge, long ActorId, int AP, int MP, int Skin)
316
        protected void InitFighter(GenericStats StatsToMerge, long ActorId, int Skin)
299
        {
317
        {
300
            // Init des stats
318
            // Init des stats
301
            this.Stats = new GenericStats();
319
            this.Stats = new GenericStats();
...
 
...
 
304
            // Init des infos generiques
322
            // Init des infos generiques
305
            this.ActorId = ActorId;
323
            this.ActorId = ActorId;
306
            this.Skin = Skin;
324
            this.Skin = Skin;
 
 
325
            this.SkinSize = 100;
307
            this.Life = MaxLife;
326
            this.Life = MaxLife;
308
        }
327
        }
309
 
328
 
...
 
...
 
316
            }
335
            }
317
 
336
 
318
            // On le vire de la cell
337
            // On le vire de la cell
319
            Cell.RemoveFighter(this);            
338
            Cell.RemoveObject(this);            
320
        }
339
        }
321
 
340
 
322
        public int TryDie(long CasterId, bool force = false)
341
        public int TryDie(long CasterId, bool force = false)
...
 
...
 
451
        /// <summary>
470
        /// <summary>
452
        /// Calcul de l'armure
471
        /// Calcul de l'armure
453
        /// </summary>
472
        /// </summary>
454
        /// <param name="Effect"></param>
473
        /// <param name="DamageEffect"></param>
455
        /// <param name="Damage"></param>
474
        public int CalculArmor(EffectEnum DamageEffect)
456
        public int CalculArmor(EffectEnum Effect)
 
 
457
        {
475
        {
458
            switch (Effect)
476
            switch (DamageEffect)
459
            {
477
            {
460
                case EffectEnum.AddArmorTerre:
478
                case EffectEnum.DamageTerre:
461
                    return this.Stats.GetTotal(EffectEnum.AddArmorTerre) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddForce) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddForce) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200);
479
                case EffectEnum.VolTerre:
 
 
480
                case EffectEnum.DamageNeutre:
 
 
481
                case EffectEnum.VolNeutre:
 
 
482
                    return (this.Stats.GetTotal(EffectEnum.AddArmorTerre) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddForce) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddForce) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200)) +
 
 
483
                           (this.Stats.GetTotal(EffectEnum.AddArmor) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddForce) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddForce) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200));
462
 
484
 
463
                case EffectEnum.AddArmorFeu:
485
                case EffectEnum.DamageFeu:
464
                    return this.Stats.GetTotal(EffectEnum.AddArmorFeu) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200);
486
                case EffectEnum.VolFeu:
465
 
487
                    return (this.Stats.GetTotal(EffectEnum.AddArmorFeu) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200)) +
466
                case EffectEnum.AddArmorEau:
488
                           (this.Stats.GetTotal(EffectEnum.AddArmor) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200));
467
                    return this.Stats.GetTotal(EffectEnum.AddArmorAir) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200);
 
 
468
                   
 
 
469
                case EffectEnum.AddArmorAir:
 
 
470
                    return this.Stats.GetTotal(EffectEnum.AddArmorEau) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddChance) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddChance) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200);
 
 
471
 
489
 
472
                case EffectEnum.AddArmor:
490
                case EffectEnum.DamageAir:
473
                     return this.Stats.GetTotal(EffectEnum.AddArmor) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200);     
491
                case EffectEnum.VolAir:
 
 
492
                    return (this.Stats.GetTotal(EffectEnum.AddArmorAir) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200)) +
 
 
493
                           (this.Stats.GetTotal(EffectEnum.AddArmor) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddAgilite) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200));
 
 
494
 
 
 
495
                case EffectEnum.DamageEau:
 
 
496
                case EffectEnum.VolEau:
 
 
497
                    return (this.Stats.GetTotal(EffectEnum.AddArmorEau) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddChance) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddChance) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200)) +
 
 
498
                           (this.Stats.GetTotal(EffectEnum.AddArmor) * Math.Max(1 + this.Stats.GetTotal(EffectEnum.AddChance) / 100, 1 + this.Stats.GetTotal(EffectEnum.AddChance) / 200 + this.Stats.GetTotal(EffectEnum.AddIntelligence) / 200));
 
 
499
 
474
            }
500
            }
475
 
501
 
476
            return 0;
502
            return 0;
File was changed - ok, show the diff
File was changed - ok, show the diff
Show contents
78
26
            return this.myFighters;
26
            return this.myFighters;
27
        }
27
        }
28
 
28
 
 
 
29
        public List<Fighter> GetAliveFighters()
 
 
30
        {
 
 
31
            return this.myFighters.Where(x => !x.Dead).ToList();
 
 
32
        }
 
 
33
 
29
        public Fighter Leader
34
        public Fighter Leader
30
        {
35
        {
31
            get;
36
            get;
78
17
 
17
 
18
        public void InitTurns(IEnumerable<Fighter> Fighters)
18
        public void InitTurns(IEnumerable<Fighter> Fighters)
19
        {
19
        {
20
            this.myFightersTurn = Fighters.OrderBy(Fighter => Fighter.Initiative).ToList();
20
            this.myFightersTurn = Fighters.OrderByDescending(Fighter => Fighter.Initiative).ToList();
21
        }
21
        }
22
 
22
 
23
        public Fighter GetNextFighter()
23
        public Fighter GetNextFighter()
File was changed - ok, show the diff
Show contents
Show contents
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff
File was changed - ok, show the diff