コード例 #1
0
ファイル: FightShield.cs プロジェクト: nightwolf93/Crystal
 public FightShield(Fighter caster, Fighter protectedFighter, Engines.Spells.SpellLevel spellLevel, int element)
 {
     this.Caster = caster;
     this.ProtectedFighter = protectedFighter;
     this.SpellLevel = spellLevel;
     this.ProtectedElements.Add(element);
 }
コード例 #2
0
 public static void AddArmor(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets)
 {
     foreach (var target in targets)
     {
         target.AddBuff(caster.ID, new Spells.Buffs.AddArmorBuff(effect.Value, effect.Turn, target), 0, effect.Value, true, effect);
     }
 }
コード例 #3
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        /// <summary>
        /// Init fight with mobs
        /// </summary>
        public Fight(Fighter fighter1, Engines.Map.MonsterGroup monsters, Engines.MapEngine map,
                                                        Enums.FightTypeEnum fightType = Enums.FightTypeEnum.PvM)
        {
            //Stop the bonus timer
            monsters.StopBonusTimer();

            this.FightType = fightType;
            this.Map = map;
            this.ID = this.Map.GetActorAvailableID;
            this.RedTeam = new FightTeam(0, fighter1, this, false);
            this.BlueTeam = new FightTeam(1, new Fighter(-9, monsters.Leader, monsters), this, true);
            this.InitPlaces();
            this.InitMontersGroup(monsters);
            this.InitTimeline();
            this.PlacePlayer(fighter1);
            this.StartTime = Environment.TickCount;
            this.InitCheckFight();
            if (FightType == Enums.FightTypeEnum.PvM)
            {
                this.StartTimer = new System.Timers.Timer(30000);
                this.StartTimer.Enabled = true;
                this.StartTimer.Elapsed += new System.Timers.ElapsedEventHandler(StartTimer_Elapsed);
                this.StartTimer.Start();
            }
        }
コード例 #4
0
 public static void AddChatiment(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets, Engines.Spells.SpellLevel spellLevel)
 {
     foreach (Fighter target in targets)
     {
         target.AddBuff(caster.ID, new Spells.Buffs.AddChatiment(effect.Value2, effect.Value, 4, target, spellLevel), 0, effect.Value, true, effect);
     }
 }
コード例 #5
0
ファイル: FightTrap.cs プロジェクト: nightwolf93/Crystal
 public FightTrap(Fighter owner, int spellID, int level, Engines.Spells.SpellLevel spellLevel, int cellID, int lenght, Enums.FightTrapType type)
 {
     this.Owner = owner;
     this.SpellLevel = spellLevel;
     this.CellID = cellID;
     this.Lenght = lenght;
     this.TrapType = type;
     this.ProcessCellsZone();
     this.UsedEffect = Helper.SpellHelper.GetSpell(spellID).Engine.GetLevel(level);
 }
コード例 #6
0
ファイル: FightTrap.cs プロジェクト: nightwolf93/Crystal
 public FightTrap(Fighter owner, int spellID, int level, Engines.Spells.SpellLevel spellLevel, int cellID, int lenght, Enums.FightTrapType type, int trapColor, int turn)
 {
     this.Owner = owner;
     this.SpellLevel = spellLevel;
     this.CellID = cellID;
     this.Lenght = lenght;
     this.TrapType = type;
     this.TrapColor = trapColor;
     this.TurnDuration = turn;
     this.ProcessCellsZone();
     this.UsedEffect = Helper.SpellHelper.GetSpell(spellID).Engine.GetLevel(level);
     this.Owner.OwnGlyph.Add(this);
 }
コード例 #7
0
ファイル: FightTeam.cs プロジェクト: nightwolf93/Crystal
 public FightTeam(int id, Fighter leader, Fight fight, bool virtualTeam)
 {
     this.ID = id;
     this.Leader = leader;
     this.Fight = fight;
     this.BladeCell = this.Leader.MapCell;
     this.VirtualTeam = virtualTeam;
     this.Restrictions = new FightRestrictions(this);
     if (!this.VirtualTeam)
     {
         this.AddToTeam(leader);
     }
 }
コード例 #8
0
 public static void AddCCBuff(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets)
 {
     int addedCC = 0;
     if (effect.Value2 > 0 && effect.Value3 > 0)
     {
         addedCC = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3);
     }
     else
     {
         addedCC = effect.Value;
     }
     foreach (Fighter target in targets)
     {
         target.AddBuff(caster.ID, new Spells.Buffs.AddCriticalBuff(addedCC, effect.Turn, target), (int)effect.Effect, addedCC, true, effect);
     }
 }
コード例 #9
0
 public bool CanJoin(Fighter fighter)
 {
     if (this.FullBlocked) return false;
     if (this.SecuredTeam.Leader.Character.Party != null && this.OnlyParty)
     {
         if (!this.SecuredTeam.Leader.Character.Party.Members.Contains(fighter.Client)) return false;
     }
     if (this.SecuredTeam.Fight.FightType == Enums.FightTypeEnum.Agression)
     {
         if (this.SecuredTeam.Leader.Character.FactionID != fighter.Character.FactionID)
         {
             return false;
         }
     }
     return true;
 }
コード例 #10
0
 public static void AddDamageFixBuff(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets)
 {
     int damagesAdded = 0;
     if (effect.Value2 > 0 && effect.Value3 > 0)
     {
         damagesAdded = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3);
     }
     else
     {
         damagesAdded = effect.Value;
     }
     foreach (Fighter target in targets)
     {
         target.AddBuff(caster.ID, new Spells.Buffs.AddFixDamage(damagesAdded, effect.Turn, target),
             (int)effect.Effect, damagesAdded, true, effect);
     }
 }
コード例 #11
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        /// <summary>
        /// Init challenge player vs player
        /// </summary>
        public Fight(Fighter fighter1, Fighter fighter2, Engines.MapEngine map, Enums.FightTypeEnum fightType)
        {
            this.FightType = fightType;
            this.Map = map;
            this.ID = this.Map.GetActorAvailableID;
            this.InitTeam(fighter1, fighter2);
            this.InitPlaces();
            this.InitTimeline();
            this.PlacePlayer(fighter1);
            this.PlacePlayer(fighter2);
            this.StartTime = Environment.TickCount;
            this.InitCheckFight();

            if (FightType == Enums.FightTypeEnum.Agression)
            {
                this.StartTimer = new System.Timers.Timer(30000);
                this.StartTimer.Enabled = true;
                this.StartTimer.Elapsed += new System.Timers.ElapsedEventHandler(StartTimer_Elapsed);
                this.StartTimer.Start();
            }
        }
コード例 #12
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public long ExpPvmFormulas(Fighter player)
 {
     long baseExp = 0;
     this.LoosersTeam.Fighters.FindAll(x => !x.IsHuman && !x.IsInvoc).ForEach(x => baseExp += x.Monster.GetTemplate.Exp);
     baseExp = baseExp * Utilities.ConfigurationManager.GetIntValue("RatePvM");
     if (player.IsHuman)
     {
         if (player.Client.Account.Vip == 1)
         {
             baseExp = baseExp * 2;
         }
     }
     return baseExp;
 }
コード例 #13
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void CheckTraps(Fighter fighter)
        {
            foreach (FightTrap trap in this.Traps.ToArray())
            {
                if (trap.WalkOnTrap(fighter.CellID))
                {
                    this.Send("GA1;306;" + fighter.ID + ";" + trap.SpellLevel.Engine.Spell.ID + "," + trap.CellID + ",407,1,1," + trap.Owner.ID);
                    this.Traps.Remove(trap);

                    trap.UseEffect(fighter.CellID);

                    trap.Owner.Team.Send("GA;999;" + trap.Owner.ID + ";GDZ-" + trap.CellID+";" + trap.Lenght + ";7");
                    trap.OwnerSend("GA;999;" + trap.Owner.ID + ";GDC" + trap.CellID);
                }
            }
        }
コード例 #14
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void CheckZombieChallenge(Fighter moved)
 {
     try
     {
         if (RedTeam.IsFriendly(moved))
         {
             foreach (var chal in this.Challenges)
             {
                 chal.OnMove(moved, moved.CurrentUsedPmThisTurn);
             }
         }
     }
     catch (Exception e)
     {
         Utilities.ConsoleStyle.Error("Can't check challenge : " + e.ToString());
     }
 }
コード例 #15
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void CheckHealChallenge(Fighter healer, Fighter healed)
 {
     try
     {
         //if (healer.Team.IsFriendly(healed))
         //{
             foreach (var chal in this.Challenges)
             {
                 chal.OnHeal(healer, healed);
             }
         //}
     }
     catch (Exception e)
     {
         Utilities.ConsoleStyle.Error("Can't check challenge : " + e.ToString());
     }
 }
コード例 #16
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void CheckMonsterKilledChallenge(Fighter killer, Fighter monster)
 {
     try
     {
         //if (RedTeam.IsFriendly(killer)) BUG WHY
         //{
             foreach (var chal in this.Challenges)
             {
                 chal.OnMosterDie(killer, monster);
             }
         //}
     }
     catch (Exception e)
     {
         Utilities.ConsoleStyle.Error("Can't check challenge : " + e.ToString());
     }
 }
コード例 #17
0
ファイル: FightTeam.cs プロジェクト: nightwolf93/Crystal
 public bool IsFriendly(Fighter fighter)
 {
     return fighter.Team.ID == this.ID;
 }
コード例 #18
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void ShowFightToClient(Fighter fighter)
        {
            this.Send("GM|+" + fighter.DisplayPattern);
            switch (this.FightType)
            {
                case Enums.FightTypeEnum.Challenge:
                    fighter.Send("GJK2|1|1|0|0|0");
                    break;

                case Enums.FightTypeEnum.PvM:
                    fighter.Send("GJK2|0|1|0|29999|4");
                    break;

                case Enums.FightTypeEnum.Kolizeum:
                case Enums.FightTypeEnum.Agression:
                    fighter.Send("GJK2|0|1|0|29999|1");
                    break;
            }
            fighter.Send("GP" + this.DisplayPatternPlace + "|" + fighter.Team.ID);
            fighter.Send("GM" + this.DisplayPatternFighters);
        }
コード例 #19
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void ChangePlayerPlace(Fighter fighter, int cellID)
 {
     if (fighter.Team.PlacementsPlaces.Contains(cellID))
     {
         if (!fighter.Team.HaveFightersOnThisPlace(cellID) && !fighter.IsReady)
         {
             fighter.CellID = cellID;
             this.Send("GIC|" + fighter.ID + ";" + cellID + ";1");
         }
         else
         {
             fighter.Send("BN");
         }
     }
 }
コード例 #20
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void ChangeReadyState(Fighter fighter, int state)
 {
     if (this.State == FightState.PlacementsPhase)
     {
         if (state == 0)// Not ready
         {
             fighter.IsReady = false;
             this.Send("GR0" + fighter.ID);
         }
         else if (state == 1)// Ready for fight
         {
             fighter.IsReady = true;
             this.Send("GR1" + fighter.ID);
         }
         this.TryStartFight();
     }
 }
コード例 #21
0
 public static void SummonCreature(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID)
 {
     if (fight.GetFighterOnCell(cellID) == null)
     {
         Database.Records.MonstersTemplateRecord template = World.Helper.MonsterHelper.GetMonsterTemplate(effect.Value);
         if (template != null)
         {
             Database.Records.MonsterLevelRecord level = template.Levels.FirstOrDefault(x => x.Level == spellLevel.Level);
             if (level != null)
             {
                 Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, level, null);
                 summonedCreature.CellID      = cellID;
                 summonedCreature.SummonOwner = caster.ID;
                 summonedCreature.IsInvoc     = true;
                 fight.CurrentEntityTempID--;
                 fight.AddPlayer(summonedCreature, caster.Team.ID, cellID);
                 fight.TimeLine.RemixTimeLine();
                 fight.TimelineDisplay();
             }
         }
     }
 }
コード例 #22
0
        public static void ApplyEffect(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID,
                                       List <Fighter> targets)
        {
            if (Program.DebugMode)
            {
                Utilities.ConsoleStyle.Debug("Used effect : " + effect.Effect.ToString() + "(" + spellLevel.TypeOfSpell.ToString() + ")");
            }
            switch (effect.Effect)
            {
            case Enums.SpellsEffects.None:
                Teleport(fight, caster, cellID);
                break;

            case Enums.SpellsEffects.Teleport:
                Teleport(fight, caster, cellID);
                break;

            case Enums.SpellsEffects.DamageNeutre:
                DirectDamages(fight, caster, targets, effect, 1);
                break;

            case Enums.SpellsEffects.DamageLifeNeutre:
                DirectLifeDamages(fight, caster, targets, effect);
                break;

            case Enums.SpellsEffects.DamageTerre:
                DirectDamages(fight, caster, targets, effect, 1);
                break;

            case Enums.SpellsEffects.DamageFeu:
                DirectDamages(fight, caster, targets, effect, 2);
                break;

            case Enums.SpellsEffects.DamageEau:
                DirectDamages(fight, caster, targets, effect, 3);
                break;

            case Enums.SpellsEffects.DamageAir:
                DirectDamages(fight, caster, targets, effect, 4);
                break;

            case Enums.SpellsEffects.VolTerre:
                StealLifeDamages(fight, caster, targets, effect, 1);
                break;

            case Enums.SpellsEffects.VolFeu:
                StealLifeDamages(fight, caster, targets, effect, 2);
                break;

            case Enums.SpellsEffects.VolEau:
                StealLifeDamages(fight, caster, targets, effect, 3);
                break;

            case Enums.SpellsEffects.VolAir:
                StealLifeDamages(fight, caster, targets, effect, 4);
                break;

            case Enums.SpellsEffects.Heal:
                Heal(fight, caster, targets, effect);
                break;

            case Enums.SpellsEffects.AddPA:
                AddAPBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddPM:
                AddMPBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddVitalite:
                AddLifeBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddDamagePercent:
                AddDamagePercentBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddDamage:
                AddDamageFixBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.SubPA:
                SubAPBuff(fight, caster, effect, targets, false);
                break;

            case Enums.SpellsEffects.SubPAEsquive:
                SubAPBuff(fight, caster, effect, targets, true);
                break;

            case Enums.SpellsEffects.SubPM:
                SubMPBuff(fight, caster, effect, targets, false);
                break;

            case Enums.SpellsEffects.SubPMEsquive:
                SubMPBuff(fight, caster, effect, targets, true);
                break;

            case Enums.SpellsEffects.SubPO:
                SubPOBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddPO:
                AddPOBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddDamageCritic:
                AddCCBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddAgilite:
                AddAgilityBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddForce:
                AddStrenghtBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.DamageLife:
                DirectLifeDamages(fight, caster, targets, effect);
                break;

            case Enums.SpellsEffects.PushBack:
                PushBack(fight, caster, targets, cellID, effect);
                break;

            case Enums.SpellsEffects.PushFear:
                PushFear(fight, caster, cellID, effect);
                break;

            case Enums.SpellsEffects.PushFront:
                PushFront(fight, caster, targets, cellID, effect);
                break;

            case Enums.SpellsEffects.Transpose:
                Transpose(fight, caster, targets, cellID, effect);
                break;

            case Enums.SpellsEffects.MultiplyDamage:
                AddDamagePercentBuff(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.UseTrap:
                UseTrap(fight, caster, effect, spellLevel, cellID);
                break;

            case Enums.SpellsEffects.AddCreature:
                SummonCreature(fight, effect, spellLevel, caster, cellID);
                break;

            case Enums.SpellsEffects.UseGlyph:
                UseGlyph(fight, caster, effect, spellLevel, cellID);
                break;

            case Enums.SpellsEffects.Invisible:
                UseInvisibleState(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.UseCopyHuman:
                SummonDouble(fight, effect, spellLevel, caster, cellID);
                break;

            case Enums.SpellsEffects.ChangeSkin:
                ChangeSkin(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.AddState:
                AddState(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.LostState:
                LostState(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.Porter:
                Wear(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.Lancer:
                LaunchWeared(fight, caster, effect, targets, cellID);
                break;

            case Enums.SpellsEffects.AddChatiment:
                AddChatiment(fight, caster, effect, targets, spellLevel);
                break;

            case Enums.SpellsEffects.AddRenvoiDamage:
                AddReverseDamage(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.LuckEcaflip:
                AddLuckEcaflip(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddArmor:
                AddArmor(fight, caster, effect, targets);
                break;

            case Enums.SpellsEffects.AddReverseSpell:
                AddReverseSpell(fight, caster, effect, spellLevel, targets);
                break;
            }
        }
コード例 #23
0
ファイル: FightTeam.cs プロジェクト: nightwolf93/Crystal
 public void AddFighter(Fighter fighter)
 {
     this.Fighters.Add(fighter);
     fighter.Team = this;
     if(Fight.State == Fights.Fight.FightState.PlacementsPhase)
         this.Fight.Map.Send("Gt" + this.ID + "|+" + fighter.ID + ";" + fighter.Nickname + ";" + fighter.Level);
 }
コード例 #24
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void AddPlayer(Fighter fighter, int teamID, int cellID = -1)
 {
     FightTeam team = teamID == 0 ? RedTeam : BlueTeam;
     team.AddFighter(fighter);
     if(cellID == -1)
         this.PlacePlayer(fighter);
     this.ShowFightToClient(fighter);
 }
コード例 #25
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void UseWeapon(Fighter fighter, int cellID)
        {
            if (fighter.Character.Items.GetItemAtPos(1) != null)
            {
                fighter.Send("GAS" + fighter.ID);

                Database.Records.WorldItemRecord item = fighter.Character.Items.GetItemAtPos(1);

                bool failedHit = false;

                if (Utilities.Basic.Rand(0, item.GetTemplate.Engine.TauxEC) == 1)
                {
                    failedHit = true;
                }

                if (!failedHit)
                {
                    if (fighter.CurrentAP >= item.Engine.CostInPa)
                    {
                        fighter.CurrentAP -= item.Engine.CostInPa;

                        bool criticatHit = false;
                        int tauxCC = item.Engine.TauxCC - fighter.Character.Stats.CriticalBonus.Total;
                        if (tauxCC < 2) tauxCC = 2;

                        if (Utilities.Basic.Rand(0, tauxCC) == 1)
                        {
                            criticatHit = true;
                        }

                        if (fighter.Client.Action.GodMode)
                        {
                            criticatHit = true;
                        }

                        this.Send("GA;303;" + fighter.ID + ";" + cellID);
                        List<Fighter> targets = GetFighterInZoneForWeapon(fighter, item.GetTemplate.Type, cellID);
                        foreach (Fighter target in targets)
                        {
                            foreach (World.Handlers.Items.Effect effect in item.Engine.Effects)
                            {
                                if (item.Engine.IsWeaponEffect(effect.ID))
                                {
                                    int baseDamage = 0;
                                    if (criticatHit)
                                    {
                                        this.Send("GA;301;" + fighter.ID + ";");
                                        baseDamage = Utilities.Basic.Rand(effect.Des.Min, effect.Des.Max);
                                    }
                                    else
                                    {
                                        baseDamage = Utilities.Basic.Rand(effect.Des.Min, effect.Des.Max);
                                    }
                                    if (GetElementForEffect(effect.ID) != 0)
                                    {
                                        int damages = FightSpellEffects.RandomDamages(baseDamage, fighter, GetElementForEffect(effect.ID));
                                        target.TakeDamages(target.ID, -damages, GetElementForEffect(effect.ID));
                                    }
                                    else if(GetStealElementForEffect(effect.ID) != 0)
                                    {
                                        int damages = FightSpellEffects.RandomDamages(baseDamage, fighter, GetStealElementForEffect(effect.ID));
                                        int stealedLife = (int)Math.Truncate((double)(damages / 2));
                                        target.TakeDamages(target.ID, -damages, GetStealElementForEffect(effect.ID));
                                        fighter.Heal(fighter.ID, stealedLife, GetStealElementForEffect(effect.ID));
                                    }
                                }
                            }
                        }
                    }
                    this.Send("GA;102;" + fighter.ID + ";" + fighter.ID + ",-" + item.Engine.CostInPa);
                }
                this.Send("GAF0|" + fighter.ID);
            }
        }
コード例 #26
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void FighterDisconnection(Fighter fighter)
        {
            switch (this.State)
            {
                case FightState.PlacementsPhase:
                    this.QuitBattle(fighter);
                    break;

                case FightState.Fighting:
                    this.QuitBattle(fighter);
                    break;
            }
        }
コード例 #27
0
 public static int RandomHeal(Fighter fighter, int effectBase)
 {
     return((int)Math.Floor((double)(effectBase * (100 + fighter.Stats.Fire.Total) / 100 + fighter.Stats.HealPointBonus.Total)));
 }
コード例 #28
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void FinishTurnRequest(Fighter fighter)
 {
     if (fighter.ID == this.TimeLine.CurrentFighter.ID)
     {
         this.CheckEndTurnChallenge(fighter);
         fighter.ResetPoints();
         if (fighter.NextCell != -1)
         {
             PlayerEndMove(fighter);
         }
         this.TimeLine.NextPlayer();
     }
 }
コード例 #29
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
 public void CheckEndTurnChallenge(Fighter fighter)
 {
     try
     {
         if (RedTeam.IsFriendly(fighter))
         {
             foreach (var chal in this.Challenges)
             {
                 chal.OnEndTurn(fighter);
             }
         }
     }
     catch (Exception e)
     {
         Utilities.ConsoleStyle.Error("Can't check challenge : " + e.ToString());
     }
 }
コード例 #30
0
 public static void UseGlyph(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, int cell)
 {
     fight.AddGlyph(new FightTrap(caster, effect.Value, effect.Value2, spellLevel, cell, Engines.Pathfinding.GetDirNum(spellLevel.TypePO.Substring(1, 1)), Enums.FightTrapType.GLYPH, effect.Value3, effect.Turn));
 }
コード例 #31
0
        public static void SummonDouble(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID)
        {
            /* Create temp template for double summoned */
            Database.Records.MonstersTemplateRecord tempTemplate = new Database.Records.MonstersTemplateRecord()
            {
                ID     = -1,
                Color1 = caster.Character.Color1,
                Color2 = caster.Character.Color2,
                Color3 = caster.Character.Color3,
                Skin   = caster.Character.Look,
                Name   = caster.Nickname,
                Exp    = 0,
                Kamas  = "0,0",
                Drops  = "",
                AI     = 2,
            };
            Database.Records.MonsterLevelRecord tempLevel = new Database.Records.MonsterLevelRecord()
            {
                ID           = -1,
                TemplateID   = -1,
                IsTempLevel  = true,
                TempTemplate = tempTemplate,
                Level        = caster.Level,
                AP           = caster.Stats.GetMaxActionPoints,
                MP           = caster.Stats.GetMaxMovementPoints,
                Life         = caster.Stats.MaxLife,
                Size         = caster.Character.Scal,
                Stats        = "0,0,0,0,0",
                ProtectStats = "0,0,0,0",
                Spells       = "",
            };
            tempLevel.InitMonster();
            Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, tempLevel, null);

            summonedCreature.CellID      = cellID;
            summonedCreature.SummonOwner = caster.ID;
            summonedCreature.IsInvoc     = true;
            fight.CurrentEntityTempID--;
            fight.AddPlayer(summonedCreature, caster.Team.ID, cellID);
            fight.TimeLine.RemixTimeLine();
            fight.TimelineDisplay();
        }
コード例 #32
0
ファイル: FightTeam.cs プロジェクト: nightwolf93/Crystal
 public void AddToTeam(Fighter fighter)
 {
     fighter.Team = this;
     this.Fighters.Add(fighter);
 }
コード例 #33
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void ApplyEffects(Fighter fighter, Engines.Spells.SpellLevel spellLevel, List<Engines.Spells.SpellEffect> effects,
                                int cellid, bool cc, bool IsTrap, List<Fighter> onTrap = null)
        {
            int effectNum = 0;

            foreach (Engines.Spells.SpellEffect effect in effects)
            {
                try
                {
                    #region Zone

                    string viewEffect = "Pa";
                    try
                    {
                        string viewType = cc ? spellLevel.TypePO.Substring(spellLevel.Effects.Count * 2) : spellLevel.TypePO.Substring(0, spellLevel.Effects.Count * 2);
                        viewEffect = viewType.Substring(effectNum * 2, 2);
                    }
                    catch (Exception e)
                    {
                        viewEffect = "Pa";
                    }

                    List<Fighter> targets = null;

                    if (IsTrap)
                    {
                        targets = onTrap;
                    }
                    else
                    {
                        targets = GetFighterInZone(viewEffect, cellid);
                    }

                    #endregion

                    #region Targets

                    if (effect.Targets != null)
                    {
                        //Check targets
                        if (!effect.Targets.Ennemies)
                        {
                            targets.ToArray().ToList().FindAll(x => !fighter.Team.IsFriendly(x)).ForEach(x => targets.Remove(x));
                        }
                        if (!effect.Targets.Friends)
                        {
                            targets.ToArray().ToList().FindAll(x => fighter.Team.IsFriendly(x)).ForEach(x => targets.Remove(x));
                        }
                        if (!effect.Targets.Caster)
                        {
                            if (targets.Contains(fighter))
                                targets.Remove(fighter);
                        }
                        if (effect.Targets.CasterPlus)
                        {
                            if (!targets.Contains(fighter))
                                targets.Add(fighter);
                        }

                        //Manual fix
                        //Dissolution
                        if (spellLevel.Engine.Spell.ID == 439)
                        {
                            if (targets.Contains(fighter))
                                targets.Remove(fighter);
                        }
                    }

                    //Reverse spell
                    foreach (var target in targets.ToArray())
                    {
                        if (target.HasReverseSpellBuff() != null && !target.Team.IsFriendly(fighter))
                        {
                            if (target.HasReverseSpellBuff().Level >= spellLevel.Level)
                            {
                                targets.Remove(target);
                                targets.Add(fighter);
                                this.Send("GA;106;" + target.ID + ";" + target.ID + ",1");
                            }
                        }
                    }

                    #endregion

                    FightSpellEffects.ApplyEffect(this, effect, spellLevel, fighter, cellid, targets);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error : " + e.ToString());
                }
                effectNum++;
            }
        }
コード例 #34
0
ファイル: SpellBuff.cs プロジェクト: nightwolf93/Crystal
 public SpellBuff(int duration, bool canDebuff, Fighter fighter)
 {
     this.Duration = duration;
     this.CanDebuff = canDebuff;
     this.BuffedFighter = fighter;
 }
コード例 #35
0
ファイル: Fight.cs プロジェクト: nightwolf93/Crystal
        public void CastSpell(Fighter fighter, Game.Spells.WorldSpell spell, int level, int cellid)
        {
            Engines.Spells.SpellLevel spellLevel = spell.Template.Engine.GetLevel(level);

            if (fighter.CurrentAP >= spellLevel.CostPA)
            {
                if (!fighter.CanCastSpell(spellLevel.Engine.Spell.ID))
                {
                    fighter.Client.Action.SystemMessage("Le cooldown du sort n'est pas encore lever !");
                    return;
                }

                fighter.Send("GAS" + fighter.ID);
                fighter.CurrentAP -= spellLevel.CostPA;

                bool failedHit = false;

                if (Utilities.Basic.Rand(0, spellLevel.TauxEC) == 1)
                {
                    failedHit = true;
                }

                if (!failedHit)
                {
                    this.Send("GA;300;" + fighter.ID + ";" + spell.Template.ID + ","
                        + cellid + "," + spell.Template.SpriteID + "," + level + "," + spell.Template.SpriteInfos);

                    bool criticatHit = false;
                    int tauxCC = spellLevel.TauxCC - fighter.Stats.CriticalBonus.Total;
                    if (tauxCC < 2) tauxCC = 2;

                    if (Utilities.Basic.Rand(0, tauxCC) == 1)
                    {
                        criticatHit = true;
                    }

                    if (fighter.IsHuman)
                    {
                        if (fighter.Client.Action.GodMode)
                        {
                            criticatHit = true;
                        }
                    }

                    if (criticatHit && spellLevel.Effects.FindAll(x => x.Effect != Enums.SpellsEffects.DoNothing && x.Effect != Enums.SpellsEffects.None).Count > 0)
                    {
                        this.Send("GA;301;" + fighter.ID + ";" + spell.SpellID);
                        this.ApplyEffects(fighter, spellLevel, spellLevel.Effects, cellid, criticatHit, false);
                    }
                    else
                    {
                        this.ApplyEffects(fighter, spellLevel, spellLevel.CriticalEffects, cellid, criticatHit, false);
                    }

                    //Apply new cooldown (FIXED IN THE 1.0.2.1)
                    if (spellLevel.TurnNumber > 0)
                    {
                        if (!fighter.Cooldowns.ContainsKey(spellLevel.Engine.Spell.ID))
                        {
                            fighter.Cooldowns.Add(spellLevel.Engine.Spell.ID, new FightSpellCooldown(spellLevel.Engine.Spell.ID, spellLevel.TurnNumber));
                        }
                    }
                }
                else
                {
                    this.Send("GA;302;" + fighter.ID + ";" + spell.SpellID);
                    if (spellLevel.ECCanEndTurn)
                    {
                        FinishTurnRequest(fighter);
                    }
                }

                this.Send("GA;102;" + fighter.ID + ";" + fighter.ID + ",-" + spellLevel.CostPA);
                fighter.Send("GAF0|" + fighter.ID);
            }
            else
            {
                fighter.Client.Action.SystemMessage("Le nombre de PA requis est supérieur aux votre actuellement !");
            }
        }