コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public SkinChangeBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            var malusType = _targetMalus[CastInfos.EffectType];
            var bonusType = _casterBonus[CastInfos.EffectType];

            var malusInfos = new CastInfos(malusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Target);
            var bonusInfos = new CastInfos(bonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Target);
            var damageValue = 0;

            if (CastInfos.Target == CastInfos.Caster)
                return FightActionResultEnum.RESULT_NOTHING;

            // Malus a la cible
            var BuffStats = new StatsBuff(malusInfos, CastInfos.Target);
            if (BuffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            CastInfos.Target.BuffManager.AddBuff(BuffStats);

            // Bonus au lanceur
            BuffStats = new StatsBuff(bonusInfos, CastInfos.Caster);
            CastInfos.Caster.BuffManager.AddBuff(BuffStats);

            return BuffStats.ApplyEffect(ref damageValue);
        }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public void CheckSpell(AbstractFighter fighter, CastInfos castInfos)
 {
     foreach (var challenge in m_challenges)
     {
         challenge.CheckSpell(fighter, castInfos);
     }
 }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Target"></param>
        public StateBuff(CastInfos CastInfos, AbstractFighter Target)
            : base(CastInfos, Target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var damageCoef = CastInfos.Value1;
            var healCoef   = CastInfos.Value2;
            var chance     = CastInfos.Value3;
            var chanceJet  = Util.Next(0, 100);

            if (chanceJet < chance)
            {
                var HealValue = damageValue * healCoef;

                if (HealEffect.ApplyHeal(CastInfos, Target, ref HealValue) == FightActionResultEnum.RESULT_END)
                {
                    return(FightActionResultEnum.RESULT_END);
                }

                damageValue = 0;
            }
            else // Multiplication des dommages
            {
                damageValue *= damageCoef;
            }

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            var infos = CastInfos.Caster.StateManager.FindState(FighterStateEnum.STATE_CARRIER);

            if (infos != null)
            {
                var target = infos.Target;

                if (target.StateManager.HasState(FighterStateEnum.STATE_CARRIED))
                {
                    var cell = target.Fight.GetCell(CastInfos.CellId);
                    if (cell.CanWalk)
                    {
                        var sleepTime = 1 + (WorldConfig.FIGHT_PANDA_LAUNCH_CELL_TIME * Pathfinding.GoalDistance(target.Fight.Map, target.Cell.Id, CastInfos.CellId));

                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaLaunch, CastInfos.Caster.Id, CastInfos.CellId.ToString()));

                        target.Fight.SetSubAction(() =>
                        {
                            return(target.SetCell(cell));
                        }, sleepTime);
                    }
                }
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            if (damageInfos.SpellId == CastInfos.SpellId)
                damageValue += CastInfos.Value3;

            return base.ApplyEffect(ref damageValue, damageInfos);
        }
コード例 #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            // Les buffs ne fonctionnent que sur les équipiés je crois
            switch (castInfos.SpellId)
            {
                case 1:
                    castInfos.Target.Statistics.AddDon(EffectEnum.AddArmorFire, castInfos.Value1);
                    break;

                case 6:
                    castInfos.Target.Statistics.AddDon(EffectEnum.AddArmorEarth, castInfos.Value1);
                    break;

                case 14:
                    castInfos.Target.Statistics.AddDon(EffectEnum.AddArmorAir, castInfos.Value1);
                    break;

                case 18:
                    castInfos.Target.Statistics.AddDon(EffectEnum.AddArmorWater, castInfos.Value1);
                    break;

                default:
                    castInfos.Target.Statistics.AddDon(EffectEnum.AddArmor, castInfos.Value1);
                    break;
            }

            // Ajout du buff
            castInfos.Target.BuffManager.AddBuff(new ArmorBuff(castInfos, castInfos.Target));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="castInfos"></param>
 /// <returns></returns>
 public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
 {
     foreach (var cell in CellZone.GetCells(castInfos.Map, castInfos.CellId, castInfos.Target.Cell.Id, castInfos.RangeType))
     {
         var fightCell = castInfos.Fight.GetCell(cell);
         if (fightCell != null)
         {
             foreach (var fightObject in fightCell.FightObjects)
             {
                 if (fightObject.Cell.Id == cell)
                 {
                     if (fightObject.ObstacleType == FightObstacleTypeEnum.TYPE_TRAP)
                     {
                         var trap = (FightTrap)fightObject;
                         trap.Appear(castInfos.Caster.Team);
                     }
                     else if (fightObject.ObstacleType == FightObstacleTypeEnum.TYPE_FIGHTER)
                     {
                         var fighter = (AbstractFighter)fightObject;
                         if (fighter.Team != castInfos.Caster.Team)
                         {
                             if (fighter.StateManager.HasState(FighterStateEnum.STATE_STEALTH))
                             {
                                 fighter.BuffManager.RemoveStealth();
                             }
                         }
                     }
                 }
             }
         }
     }
     return(FightActionResultEnum.RESULT_NOTHING);
 }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            int direction         = Pathfinding.GetDirection(castInfos.Map, castInfos.Caster.Cell.Id, castInfos.CellId);
            var targetFighterCell = Pathfinding.NextCell(castInfos.Map, castInfos.Caster.Cell.Id, direction);

            var target = castInfos.Fight.GetFighterOnCell(targetFighterCell);

            if (target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var distance    = Pathfinding.GoalDistance(castInfos.Map, target.Cell.Id, castInfos.CellId);
            var currentCell = target.Cell;

            for (int i = 0; i < distance; i++)
            {
                var nextCell = castInfos.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        castInfos.Fight.SetSubAction(() =>
                        {
                            return(target.SetCell(nextCell));
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return(FightActionResultEnum.RESULT_NOTHING);
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    castInfos.Fight.SetSubAction(() =>
                    {
                        return(target.SetCell(currentCell));
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                currentCell = nextCell;
            }

            castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            castInfos.Fight.SetSubAction(() =>
            {
                return(target.SetCell(currentCell));
            }, 1 + distance * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            var damageJet = castInfos.RandomJet;
            castInfos.EffectType = Spell.EffectEnum.DamageNeutral;

            return DamageEffect.ApplyDamages(castInfos, castInfos.Caster, ref damageJet);
        }
コード例 #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            // cant reflect a spell himself
            if (damageInfos.Caster == Target)
                return FightActionResultEnum.RESULT_NOTHING;

            // reflect only spells
            if (damageInfos.SpellId < 1)
                return FightActionResultEnum.RESULT_NOTHING;

            // cannot reflect a spell that is higher in level
            if (damageInfos.SpellLevel > CastInfos.Value2)
                return FightActionResultEnum.RESULT_NOTHING;

            // cant reflect reflected damage or poison or a trap damage
            if (damageInfos.IsReflect || damageInfos.IsPoison || damageInfos.IsTrap)
                return FightActionResultEnum.RESULT_NOTHING;

            // cancel damage
            damageValue = 0;

            // damaged are being reflected
            damageInfos.IsReflect = true;

            // new jet for new target
            var damageJet = damageInfos.RandomJet;

            // apply damage back to the caster
            return DamageEffect.ApplyDamages(damageInfos, damageInfos.Caster, ref damageJet);
        }
コード例 #13
0
        /// <summary>
        /// Ajout le boost
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            int showValue;

            switch (CastInfos.EffectType)
            {
            case EffectEnum.SubAP:
            case EffectEnum.SubMP:
            case EffectEnum.SubAPDodgeable:
            case EffectEnum.SubMPDodgeable:
                showValue = -CastInfos.Value1;
                break;

            default:
                showValue = CastInfos.Value1;
                break;
            }

            if (CastInfos.EffectType != EffectEnum.ReflectSpell)
            {
                Target.Fight.Dispatch(WorldMessage.GAME_ACTION(CastInfos.EffectType, Target.Id, Target.Id + "," + showValue + "," + Duration));
            }

            Target.Statistics.AddDon(CastInfos.EffectType, CastInfos.Value1);

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
コード例 #14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="castInfos"></param>
 /// <returns></returns>
 public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
 {
     foreach (var cell in CellZone.GetCells(castInfos.Map, castInfos.CellId, castInfos.Target.Cell.Id, castInfos.RangeType))
     {
         var fightCell = castInfos.Fight.GetCell(cell);
         if(fightCell != null)
         {
             foreach(var fightObject in fightCell.FightObjects)
             {
                 if(fightObject.Cell.Id == cell)
                 {
                     if(fightObject.ObstacleType == FightObstacleTypeEnum.TYPE_TRAP)
                     {
                         var trap = (FightTrap)fightObject;
                         trap.Appear(castInfos.Caster.Team);
                     }
                     else if (fightObject.ObstacleType == FightObstacleTypeEnum.TYPE_FIGHTER)
                     {
                         var fighter = (AbstractFighter)fightObject;
                         if(fighter.Team != castInfos.Caster.Team)
                         {
                             if(fighter.StateManager.HasState(FighterStateEnum.STATE_STEALTH))
                             {
                                 fighter.BuffManager.RemoveStealth();
                             }
                         }
                     }
                 }
             }
         }
     }
     return FightActionResultEnum.RESULT_NOTHING;
 }
コード例 #15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            var infos = CastInfos.Caster.StateManager.FindState(FighterStateEnum.STATE_CARRIER);

            if (infos != null)
            {
                var target = infos.Target;

                if (target.StateManager.HasState(FighterStateEnum.STATE_CARRIED))
                {
                    var cell = target.Fight.GetCell(CastInfos.CellId);
                    if (cell.CanWalk)
                    {
                        var sleepTime = 1 + (WorldConfig.FIGHT_PANDA_LAUNCH_CELL_TIME * Pathfinding.GoalDistance(target.Fight.Map, target.Cell.Id, CastInfos.CellId));

                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaLaunch, CastInfos.Caster.Id, CastInfos.CellId.ToString()));

                        target.Fight.SetSubAction(() =>
                        {
                            return target.SetCell(cell);
                        }, sleepTime);
                    }
                }
            }

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fighter"></param>
 /// <param name="castInfos"></param>
 public override void CheckSpell(AbstractFighter fighter, CastInfos castInfos)
 {
     if (castInfos.EffectType == EffectEnum.AddLife && castInfos.Target != null && castInfos.Target.Team == fighter.Team)
     {
         base.OnFailed(fighter.Name);
     }
 }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public SkinChangeBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var damageJet = castInfos.RandomJet;

            castInfos.EffectType = EffectEnum.DamageBrut;

            // cannot kill the target if hes an ally
            if (castInfos.Caster.Team == castInfos.Target.Team && damageJet > castInfos.Target.Life)
            {
                damageJet = castInfos.Target.Life - 1;
            }

            if (DamageEffect.ApplyDamages(castInfos, castInfos.Target, ref damageJet) == FightActionResultEnum.RESULT_END)
            {
                return(FightActionResultEnum.RESULT_END);
            }

            var healJet = damageJet / 2;

            return(HealEffect.ApplyHeal(castInfos, castInfos.Caster, ref healJet));
        }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var malusType = _targetMalus[CastInfos.EffectType];
            var bonusType = _casterBonus[CastInfos.EffectType];

            var malusInfos  = new CastInfos(malusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Target);
            var bonusInfos  = new CastInfos(bonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Target);
            var damageValue = 0;

            if (CastInfos.Target == CastInfos.Caster)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            // Malus a la cible
            var BuffStats = new StatsBuff(malusInfos, CastInfos.Target);

            if (BuffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END)
            {
                return(FightActionResultEnum.RESULT_END);
            }

            CastInfos.Target.BuffManager.AddBuff(BuffStats);

            // Bonus au lanceur
            BuffStats = new StatsBuff(bonusInfos, CastInfos.Caster);
            CastInfos.Caster.BuffManager.AddBuff(BuffStats);

            return(BuffStats.ApplyEffect(ref damageValue));
        }
コード例 #20
0
ファイル: SummoningEffect.cs プロジェクト: Urthawen/codebreak
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            var monsterTemplate = Database.Repository.MonsterRepository.Instance.GetById(castInfos.Value1);

            if (monsterTemplate == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var monsterGrade = monsterTemplate.Grades.FirstOrDefault(grade => grade.Grade == castInfos.Value2);

            if (monsterGrade == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var cell = castInfos.Fight.GetCell(castInfos.CellId);

            if (!cell.CanWalk)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            return(castInfos.Fight.SummonFighter(new MonsterEntity(castInfos.Fight.NextFighterId, monsterGrade, castInfos.Caster, m_static), castInfos.Caster.Team, castInfos.CellId));
        }
コード例 #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarrierBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Caster.StateManager.AddState(this);

            castInfos.Caster.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaCarrier, castInfos.Caster.Id, target.Id.ToString()));
        }
コード例 #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            if (castInfos.SpellId == 445)
            {
                if (castInfos.Target.Team == castInfos.Caster.Team)
                    return FightActionResultEnum.RESULT_NOTHING;
            }
            else if (castInfos.SpellId == 438)
            {
                if (castInfos.Target.Team != castInfos.Caster.Team)
                    return FightActionResultEnum.RESULT_NOTHING;
            }

            var targetTeleport = new CastInfos(EffectEnum.Teleport, castInfos.SpellId, castInfos.Caster.Cell.Id, 0, 0, 0, 0, 0, castInfos.Target, null);
            var casterTeleport = new CastInfos(EffectEnum.Teleport, castInfos.SpellId, castInfos.Target.Cell.Id, 0, 0, 0, 0, 0, castInfos.Caster, null);

            castInfos.Caster.SetCell(null);
            castInfos.Target.SetCell(null);

            if (TeleportEffect.ApplyTeleport(targetTeleport) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            if (TeleportEffect.ApplyTeleport(casterTeleport) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #23
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            var damageValue = 0;

            if (CastInfos.Duration > 1)
            {
                var subInfos = new CastInfos(EffectEnum.SubAPDodgeable, CastInfos.SpellId, 0, CastInfos.Value1, 0, 0, 0, CastInfos.Duration, CastInfos.Caster, null);
                var buff = new APDodgeSubstractBuff(subInfos, CastInfos.Target);

                buff.ApplyEffect(ref damageValue);
                CastInfos.Target.BuffManager.AddBuff(buff);
            }
            else
            {
                var subInfos = new CastInfos(EffectEnum.SubAPDodgeable, CastInfos.SpellId, 0, CastInfos.Value1, 0, 0, 0, 0, CastInfos.Caster, null);
                var buff = new APDodgeSubstractBuff(subInfos, CastInfos.Target);
                
                buff.ApplyEffect(ref damageValue);
                CastInfos.Target.BuffManager.AddBuff(buff);
            }

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #24
0
        /// <summary>
        /// Ajout le boost
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            int showValue;

            switch (CastInfos.EffectType)
            {
                case EffectEnum.SubAP:
                case EffectEnum.SubMP:
                case EffectEnum.SubAPDodgeable:
                case EffectEnum.SubMPDodgeable:
                    showValue = -CastInfos.Value1;
                    break;

                default:
                    showValue = CastInfos.Value1;
                    break;
            }

            if (CastInfos.EffectType != EffectEnum.ReflectSpell)
                Target.Fight.Dispatch(WorldMessage.GAME_ACTION(CastInfos.EffectType, Target.Id, Target.Id + "," + showValue + "," + Duration));

            Target.Statistics.AddDon(CastInfos.EffectType, CastInfos.Value1);

            return base.ApplyEffect(ref damageValue, damageInfos);
        }
コード例 #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarrierBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Caster.StateManager.AddState(this);

            castInfos.Caster.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.PandaCarrier, castInfos.Caster.Id, target.Id.ToString()));
        }
コード例 #26
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Target"></param>
        public StateBuff(CastInfos CastInfos, AbstractFighter Target)
            : base(CastInfos, Target, ActiveType.ACTIVE_STATS, DecrementType.TYPE_ENDTURN)
        {
            var damageValue = 0;

            ApplyEffect(ref damageValue);
        }
コード例 #27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            //
            if (damageInfos.IsReflect || damageInfos.IsReturnedDamages || damageInfos.IsPoison)
                return FightActionResultEnum.RESULT_NOTHING;

            // mort
            if(Caster.IsFighterDead)
            {
                Target.BuffManager.RemoveBuff(this);

                return FightActionResultEnum.RESULT_NOTHING;
            }

            var targetTeleport = new CastInfos(EffectEnum.Teleport, CastInfos.SpellId, CastInfos.Caster.Cell.Id, 0, 0, 0, 0, 0, Target, null);
            var casterTeleport = new CastInfos(EffectEnum.Teleport, CastInfos.SpellId, Target.Cell.Id, 0, 0, 0, 0, 0, CastInfos.Caster, null);

            Caster.SetCell(null);
            Target.SetCell(null);

            if (TeleportEffect.ApplyTeleport(targetTeleport) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            if (TeleportEffect.ApplyTeleport(casterTeleport) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            // cancel damages
            damageValue = 0;

            var damageJet = damageInfos.RandomJet;

            damageInfos.IsReturnedDamages = true;

            return DamageEffect.ApplyDamages(damageInfos, CastInfos.Caster, ref damageJet);
        }
コード例 #28
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarriedBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Target.StateManager.AddState(this);

            Target.SetCell(Caster.Cell);
        }
コード例 #29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        public PandaCarriedBuff(CastInfos castInfos, AbstractFighter target)
            : base(castInfos, target, ActiveType.ACTIVE_ENDMOVE, DecrementType.TYPE_ENDMOVE)
        {
            Target.StateManager.AddState(this);

            Target.SetCell(Caster.Cell);
        }
コード例 #30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            AbstractActivableObject obj = null;

            switch (castInfos.EffectType)
            {
            case EffectEnum.UseGlyph:
                if (castInfos.Caster.Fight.HasObjectOnCell(FightObstacleTypeEnum.TYPE_FIGHTER, castInfos.CellId))
                {
                    return(FightActionResultEnum.RESULT_NOTHING);
                }
                obj = new FightGlyph(castInfos.Caster.Fight, castInfos.Caster, castInfos, castInfos.CellId, castInfos.Duration);
                break;

            case EffectEnum.UseTrap:
                if (!castInfos.Caster.Fight.CanPutObject(castInfos.CellId))
                {
                    return(FightActionResultEnum.RESULT_NOTHING);
                }
                obj = new FightTrap(castInfos.Caster.Fight, castInfos.Caster, castInfos, castInfos.CellId);
                break;
            }

            if (obj != null)
            {
                castInfos.Caster.Fight.AddActivableObject(castInfos.Caster, obj);
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            if (castInfos.Duration > 1)
            {
                var subInfos = new CastInfos(EffectEnum.SubMPDodgeable, castInfos.SpellId, 0, castInfos.Value1, 0, 0, 0, castInfos.Duration, castInfos.Caster, null);
                var buff     = new MPDodgeSubstractBuff(subInfos, castInfos.Target);

                castInfos.Target.BuffManager.AddBuff(buff);
            }
            else
            {
                var damageValue = 0;
                var subInfos    = new CastInfos(EffectEnum.SubMPDodgeable, castInfos.SpellId, 0, castInfos.Value1, 0, 0, 0, 0, castInfos.Caster, null);
                var buff        = new MPDodgeSubstractBuff(subInfos, castInfos.Target);

                buff.ApplyEffect(ref damageValue);
                castInfos.Target.BuffManager.AddBuff(buff);
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            var damageJet = castInfos.RandomJet;

            castInfos.EffectType = Spell.EffectEnum.DamageNeutral;

            return(DamageEffect.ApplyDamages(castInfos, castInfos.Caster, ref damageJet));
        }
コード例 #33
0
ファイル: PushEffect.cs プロジェクト: Urthawen/codebreak
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        /// <param name="direction"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyPush(CastInfos castInfos, AbstractFighter target, int direction, int length)
        {
            var currentCell = target.Cell;

            for (int i = 0; i < length; i++)
            {
                var nextCell = target.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        target.Fight.SetSubAction(() =>
                        {
                            return(target.SetCell(nextCell));
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return(FightActionResultEnum.RESULT_NOTHING);
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    target.Fight.SetSubAction(() =>
                    {
                        if (castInfos.EffectType == EffectEnum.PushBack)
                        {
                            var pushResult = PushEffect.ApplyPushBackDamages(castInfos, target, length, i);
                            if (pushResult != FightActionResultEnum.RESULT_NOTHING)
                            {
                                return(pushResult);
                            }
                        }

                        return(target.SetCell(currentCell));
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return(FightActionResultEnum.RESULT_NOTHING);
                }

                currentCell = nextCell;
            }

            target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            target.Fight.SetSubAction(() =>
            {
                return(target.SetCell(currentCell));
            }, 1 + length * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #34
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            if (damageInfos.SpellId == CastInfos.SpellId)
            {
                damageValue += CastInfos.Value3;
            }

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
コード例 #35
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            CastInfos.Target.BuffManager.RemoveState(CastInfos.Value3);

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #36
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;
            
            castInfos.Target.BuffManager.AddBuff(new SacrificeBuff(castInfos, castInfos.Target));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #37
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            int direction = Pathfinding.GetDirection(castInfos.Map, castInfos.Caster.Cell.Id, castInfos.CellId);
            var targetFighterCell = Pathfinding.NextCell(castInfos.Map, castInfos.Caster.Cell.Id, direction);

            var target = castInfos.Fight.GetFighterOnCell(targetFighterCell);
            if (target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            var distance = Pathfinding.GoalDistance(castInfos.Map, target.Cell.Id, castInfos.CellId);
            var currentCell = target.Cell;

            for (int i = 0; i < distance; i++)
            {
                var nextCell = castInfos.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        castInfos.Fight.SetSubAction(() =>
                        {
                            return target.SetCell(nextCell);
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return FightActionResultEnum.RESULT_NOTHING;
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    castInfos.Fight.SetSubAction(() =>
                    {
                        return target.SetCell(currentCell);
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return FightActionResultEnum.RESULT_NOTHING;
                }

                currentCell = nextCell;
            }

            castInfos.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            castInfos.Fight.SetSubAction(() =>
            {
                return target.SetCell(currentCell);
            }, 1 + distance * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #38
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            castInfos.Caster.BuffManager.AddBuff(new IncreaseSpellJetBuff(castInfos, castInfos.Caster));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            CastInfos.Target.BuffManager.AddBuff(new PunishmentBuff(CastInfos, CastInfos.Target));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #40
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="target"></param>
        /// <param name="direction"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyPush(CastInfos castInfos, AbstractFighter target, int direction, int length)
        {
            var currentCell = target.Cell;

            for (int i = 0; i < length; i++)
            {
                var nextCell = target.Fight.GetCell(Pathfinding.NextCell(castInfos.Map, currentCell.Id, direction));

                if (nextCell != null && nextCell.CanWalk)
                {
                    if (nextCell.HasObject(FightObstacleTypeEnum.TYPE_TRAP))
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + nextCell.Id));

                        target.Fight.SetSubAction(() =>
                        {
                            return target.SetCell(nextCell);
                        }, 1 + ++i * WorldConfig.FIGHT_PUSH_CELL_TIME);

                        return FightActionResultEnum.RESULT_NOTHING;
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));
                    }

                    target.Fight.SetSubAction(() =>
                    {
                        if (castInfos.EffectType == EffectEnum.PushBack)
                        {
                            var pushResult = PushEffect.ApplyPushBackDamages(castInfos, target, length, i);
                            if (pushResult != FightActionResultEnum.RESULT_NOTHING)
                                return pushResult;
                        }

                        return target.SetCell(currentCell);
                    }, 1 + (i * WorldConfig.FIGHT_PUSH_CELL_TIME));

                    return FightActionResultEnum.RESULT_NOTHING;
                }

                currentCell = nextCell;
            }

            target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_PUSHBACK, target.Id, target.Id + "," + currentCell.Id));

            target.Fight.SetSubAction(() =>
            {
                return target.SetCell(currentCell);
            }, 1 + length * WorldConfig.FIGHT_PUSH_CELL_TIME);

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #41
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            if (EffectHeal.ApplyHeal(CastInfos, Target, CastInfos.GenerateJet(Target)) == -3)
            {
                return(-3);
            }
            return(-1);
            //var Damage = this.CastInfos.RandomJet;

            //return EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref Damage);
        }
コード例 #42
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            castInfos.Caster.BuffManager.AddBuff(new IncreaseSpellJetBuff(castInfos, castInfos.Caster));

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #43
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            castInfos.Target.BuffManager.AddBuff(new DamageDodgeBuff(castInfos, castInfos.Target));

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var usedAp = Target.UsedAP;
            if (usedAp < 1)
                return FightActionResultEnum.RESULT_NOTHING;

            damageInfos = new CastInfos(EffectEnum.DamageNeutral, -1, -1, -1, -1, -1, -1, -1, CastInfos.Caster, CastInfos.Target);
            var damageJet = (usedAp / CastInfos.Value1) * CastInfos.Value2;

            return DamageEffect.ApplyDamages(damageInfos, CastInfos.Target, ref damageJet);
        }
コード例 #45
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            CastInfos.Target.BuffManager.RemoveState(CastInfos.Value3);

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #46
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            CastInfos.Target.BuffManager.AddBuff(new PunishmentBuff(CastInfos, CastInfos.Target));

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #47
0
ファイル: BuffLifeDamage.cs プロジェクト: 745c5412/tera-emu
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            //var Damage = this.CastInfos.RandomJet;

            // return EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref Damage);

            int effectBase   = CastInfos.GenerateJet(Target);
            var DamageValuea = (Target.CurrentLife / 100) * effectBase;

            //DamageValuea = (-DamageValuea);
            return(EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref DamageValuea));
        }
コード例 #48
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos CastInfos)
        {
            if (CastInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            if (CastInfos.Target.BuffManager.Debuff() == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            CastInfos.Target.Fight.Dispatch(WorldMessage.GAME_ACTION(EffectEnum.DeleteAllBonus, CastInfos.Target.Id, CastInfos.Target.Id.ToString()));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #49
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DamageValue"></param>
        /// <param name="DamageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int DamageValue, CastInfos DamageInfos = null)
        {
            // Si effet finis
            if (!Target.StateManager.HasState(FighterStateEnum.STATE_CARRIED))
            {
                Duration = 0;
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            // On affecte la meme cell pour la cible porté
            return(Target.SetCell(Caster.Cell));
        }
コード例 #50
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            if (Caster.Cell.Id != Target.Cell.Id)
            {
                Target.BuffManager.RemoveState((int)FighterStateEnum.STATE_CARRIED);
                Caster.BuffManager.RemoveState((int)FighterStateEnum.STATE_CARRIER);

                Duration = 0;
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
コード例 #51
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="DamageValue"></param>
        /// <param name="DamageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int DamageValue, CastInfos DamageInfos = null)
        {
            // Si effet finis
            if (!Target.StateManager.HasState(FighterStateEnum.STATE_CARRIED))
            {
                Duration = 0;
                return FightActionResultEnum.RESULT_NOTHING;
            }

            // On affecte la meme cell pour la cible porté
            return Target.SetCell(Caster.Cell);
        }
コード例 #52
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            if (Caster.Cell.Id != Target.Cell.Id)
            {
                Target.BuffManager.RemoveState((int)FighterStateEnum.STATE_CARRIED);
                Caster.BuffManager.RemoveState((int)FighterStateEnum.STATE_CARRIER);

                Duration = 0;
            }

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #53
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var buffValue = damageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
            var statsType = (EffectEnum)CastInfos.Value1;
            var maxValue = CastInfos.Value2;
            var duration = CastInfos.Value3;

            if (Target.Fight.CurrentFighter.Id == CastInfos.FakeValue)
            {
                if (CastInfos.DamageValue < maxValue)
                {
                    if (CastInfos.DamageValue + buffValue > maxValue)
                    {
                        buffValue = maxValue - CastInfos.DamageValue;
                    }
                }
                else
                {
                    buffValue = 0;
                }
            }
            else
            {
                CastInfos.DamageValue = 0;
                CastInfos.FakeValue = (int)Target.Fight.CurrentFighter.Id;

                if (CastInfos.DamageValue + buffValue > maxValue)
                {
                    buffValue = maxValue;
                }
            }

            if (buffValue != 0)
            {
                CastInfos.DamageValue += buffValue;

                switch(statsType)
                {
                    case EffectEnum.Heal:
                        HealEffect.ApplyHeal(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target, ref buffValue);
                        break;

                    default:
                        var BuffStats = new StatsBuff(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target);
                        BuffStats.ApplyEffect(ref buffValue);
                        Target.BuffManager.AddBuff(BuffStats);
                        break;
                }
            }

            return base.ApplyEffect(ref damageValue, damageInfos);
        }
コード例 #54
0
ファイル: PunishmentBuff.cs プロジェクト: Urthawen/codebreak
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var buffValue = damageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
            var statsType = (EffectEnum)CastInfos.Value1;
            var maxValue  = CastInfos.Value2;
            var duration  = CastInfos.Value3;

            if (Target.Fight.CurrentFighter.Id == CastInfos.FakeValue)
            {
                if (CastInfos.DamageValue < maxValue)
                {
                    if (CastInfos.DamageValue + buffValue > maxValue)
                    {
                        buffValue = maxValue - CastInfos.DamageValue;
                    }
                }
                else
                {
                    buffValue = 0;
                }
            }
            else
            {
                CastInfos.DamageValue = 0;
                CastInfos.FakeValue   = (int)Target.Fight.CurrentFighter.Id;

                if (CastInfos.DamageValue + buffValue > maxValue)
                {
                    buffValue = maxValue;
                }
            }

            if (buffValue != 0)
            {
                CastInfos.DamageValue += buffValue;

                switch (statsType)
                {
                case EffectEnum.Heal:
                    HealEffect.ApplyHeal(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target, ref buffValue);
                    break;

                default:
                    var BuffStats = new StatsBuff(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target);
                    BuffStats.ApplyEffect(ref buffValue);
                    Target.BuffManager.AddBuff(BuffStats);
                    break;
                }
            }

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
コード例 #55
0
        /// <summary>
        /// Subit des dommages, activation des buffs de reduction, renvois, anihilation des dommages apres le calcul du jet
        /// </summary>
        /// <param name="castInfos"></param>
        /// <param name="damageValue"></param>
        public FightActionResultEnum OnAttackedAfterJet(CastInfos castInfos, ref int damageValue)
        {
            foreach (var buff in ActiveBuffs[ActiveType.ACTIVE_ATTACKED_AFTER_JET].ToArray())
            {
                var result = buff.ApplyEffect(ref damageValue, castInfos);
                if (result != FightActionResultEnum.RESULT_NOTHING)
                {
                    return(result);
                }
            }

            return(m_fighter.Fight.TryKillFighter(m_fighter, m_fighter));
        }
コード例 #56
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            var carrierInfos = new CastInfos(castInfos.EffectType, castInfos.SpellId, 0, 0, 0, (int)FighterStateEnum.STATE_CARRIER, 0, int.MaxValue - 1, castInfos.Caster, null);
            var carriedInfos = new CastInfos(castInfos.EffectType, castInfos.SpellId, 0, 0, 0, (int)FighterStateEnum.STATE_CARRIED, 0, int.MaxValue - 1, castInfos.Caster, null);
                        
            castInfos.Caster.BuffManager.AddBuff(new PandaCarrierBuff(carrierInfos, castInfos.Target));
            castInfos.Target.BuffManager.AddBuff(new PandaCarriedBuff(carriedInfos, castInfos.Target));

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #57
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            if (castInfos.Target != castInfos.Caster)
                return FightActionResultEnum.RESULT_NOTHING;

            var damageInfos = new CastInfos(m_damageType, -1, -1, -1, -1, -1, -1, -1, castInfos.Caster, castInfos.Target);
            var damageJet = (castInfos.Target.Life / 100) * castInfos.RandomJet;

            return DamageEffect.ApplyDamages(damageInfos, damageInfos.Target, ref damageJet);
        }
コード例 #58
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public static FightActionResultEnum ApplyTeleport(CastInfos castInfos)
        {
            var caster = castInfos.Caster;
            var cell = caster.Fight.GetCell(castInfos.CellId);

            if (cell != null)
            {
                caster.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_TELEPORT, caster.Id, caster.Id + "," + castInfos.CellId));

                return caster.SetCell(cell);
            }

            return FightActionResultEnum.RESULT_NOTHING;
        }
コード例 #59
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var usedAp = Target.UsedAP;

            if (usedAp < 1)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            damageInfos = new CastInfos(EffectEnum.DamageNeutral, -1, -1, -1, -1, -1, -1, -1, CastInfos.Caster, CastInfos.Target);
            var damageJet = (usedAp / CastInfos.Value1) * CastInfos.Value2;

            return(DamageEffect.ApplyDamages(damageInfos, CastInfos.Target, ref damageJet));
        }
コード例 #60
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
                return FightActionResultEnum.RESULT_NOTHING;

            var subInfos = new CastInfos(castInfos.EffectType, castInfos.SpellId, castInfos.CellId, castInfos.RandomJet, castInfos.Value2, castInfos.Value3, castInfos.Chance, castInfos.Duration, castInfos.Caster, castInfos.Target);
            var buffStats = new StatsBuff(subInfos, castInfos.Target);
            var damageValue = 0;
            if (buffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END)
                return FightActionResultEnum.RESULT_END;

            castInfos.Target.BuffManager.AddBuff(buffStats);

            return FightActionResultEnum.RESULT_NOTHING;
        }