示例#1
0
文件: Rollback.cs 项目: Mixi59/Stump
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                var newCell = Effect.EffectId == EffectsEnum.Effect_ReturnToLastPos ? actor.MovementHistory.PopWhile(x => x.Cell == actor.Cell, 2)?.Cell : actor.FightStartPosition?.Cell;

                if (newCell == null)
                {
                    continue;
                }

                var fighter = Fight.GetOneFighter(newCell);
                if (fighter != null && fighter != actor)
                {
                    actor.Telefrag(Caster, fighter);
                }
                else
                {
                    actor.Position.Cell = newCell;
                    actor.MovementHistory.PopPreviousPosition(); // we don't want a new entry caused by the rollback
                    ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(Fight.Clients, Caster, actor, newCell);
                }
            }

            return(true);
        }
示例#2
0
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                var monster = MonsterManager.Instance.GetMonsterGrade(Dice.DiceNum, Dice.DiceFace);

                if (monster == null)
                {
                    return(false);
                }

                actor.Die(Caster);

                var summon = new SummonedMonster(Fight.GetNextContextualId(), Caster.Team, Caster, monster, actor.Cell)
                {
                    SummoningEffect = this
                };
                ActionsHandler.SendGameActionFightSummonMessage(Fight.Clients, summon);
                Caster.AddSummon(summon);

                if (Effect.EffectId == EffectsEnum.Effect_KillAndSummon_2796 && Caster is CharacterFighter)
                {
                    summon.SetController(Caster as CharacterFighter);
                }

                Caster.Team.AddFighter(summon);
                Fight.TriggerMarks(summon.Cell, summon, TriggerType.MOVE);
            }

            return(true);
        }
示例#3
0
        public override bool Apply()
        {
            DirectionsEnum orientation = this.CastPoint.OrientationTo(this.TargetedPoint, true);
            FightActor     target      = this.Fight.GetFirstFighter <FightActor>((Predicate <FightActor>)(entry => (int)entry.Position.Cell.Id == (int)this.CastPoint.GetCellInDirection(orientation, (short)1).CellId));
            bool           flag;

            if (target == null)
            {
                flag = false;
            }
            else
            {
                Cell       startCell          = target.Cell;
                Cell       cell               = this.TargetedCell;
                MapPoint[] cellsOnLineBetween = new MapPoint(startCell).GetCellsOnLineBetween(this.TargetedPoint);
                for (int index = 0; index < cellsOnLineBetween.Length; ++index)
                {
                    MapPoint mapPoint = cellsOnLineBetween[index];
                    if (!this.Fight.IsCellFree(this.Fight.Map.Cells[(int)mapPoint.CellId]))
                    {
                        cell = index <= 0 ? startCell : this.Fight.Map.Cells[(int)cellsOnLineBetween[index - 1].CellId];
                    }
                    if (this.Fight.ShouldTriggerOnMove(this.Fight.Map.Cells[(int)mapPoint.CellId]))
                    {
                        cell = this.Fight.Map.Cells[(int)mapPoint.CellId];
                        break;
                    }
                }
                target.Cell = cell;
                this.Fight.ForEach((Action <Character>)(entry => ActionsHandler.SendGameActionFightSlideMessage((IPacketReceiver)entry.Client, this.Caster, target, startCell.Id, target.Cell.Id)));
                flag = true;
            }
            return(flag);
        }
示例#4
0
        protected override bool InternalApply()
        {
            var spellId  = Dice.DiceNum;
            var cooldown = Dice.Value;

            foreach (var actor in GetAffectedActors())
            {
                var spell = actor.GetSpell(spellId);
                if (spell == null)
                {
                    continue;
                }

                if (IsTriggerBuff())
                {
                    AddTriggerBuff(actor, TriggerBuff);
                }
                else
                {
                    actor.SpellHistory.RegisterCastedSpell(new SpellHistoryEntry(actor.SpellHistory, spell.CurrentSpellLevel,
                                                                                 Caster, actor, Fight.TimeLine.RoundNumber, cooldown));
                    ActionsHandler.SendGameActionFightSpellCooldownVariationMessage(actor.Fight.Clients, Caster, actor, spell, cooldown);
                }
            }

            return(true);
        }
示例#5
0
        public static void ApplyArmorBuff(TriggerBuff buff, FightActor triggerer, BuffTriggerType trigger, object token)
        {
            var damage = token as Fights.Damage;

            if (damage == null)
            {
                return;
            }

            var integerEffect = buff.GenerateEffect();

            if (integerEffect == null)
            {
                return;
            }

            var target = buff.Target;

            if (target is SummonedBomb)
            {
                target = ((SummonedBomb)target).Summoner;
            }

            var reduction    = target.CalculateArmorValue(integerEffect.Value);
            var dmgReduction = Math.Min(damage.Amount, target.CalculateArmorValue(integerEffect.Value));

            ActionsHandler.SendGameActionFightReduceDamagesMessage(target.Fight.Clients, damage.Source, target, reduction);
            damage.Amount -= dmgReduction;
        }
示例#6
0
        public override bool Apply()
        {
            MonsterGrade monsterGrade = Singleton <MonsterManager> .Instance.GetMonsterGrade(base.Dice.DiceNum, base.Dice.DiceFace);

            bool result;

            if (monsterGrade == null)
            {
                Summon.logger.Error <short, short>("Cannot summon monster {0} grade {1} (not found)", base.Dice.DiceNum, base.Dice.DiceFace);
                result = false;
            }
            else
            {
                if (!base.Caster.CanSummon(base.Dice.DiceNum))
                {
                    result = false;
                }
                else
                {
                    bool            visible         = (monsterGrade.Template.Id == (int)MonsterEnum.SADIDA_TREE) ? false : true; //Need to make a better method
                    SummonedMonster summonedMonster = new SummonedMonster(base.Fight.GetNextContextualId(), base.Caster.Team, base.Caster, monsterGrade, base.TargetedCell, visible);
                    ActionsHandler.SendGameActionFightSummonMessage(base.Fight.Clients, summonedMonster);
                    base.Caster.AddSummon(summonedMonster);
                    base.Caster.Team.AddFighter(summonedMonster);
                    result = true;
                }
            }
            return(result);
        }
        public override bool Apply()
        {
            FightActor fightActor = base.GetAffectedActors().FirstOrDefault <FightActor>();

            if (fightActor != null)
            {
                if (fightActor.PreviousPosition != null)
                {
                    Cell destCell = this.Fight.Cells[fightActor.Position.Point.GetNearestCellInOppositeDirection(fightActor.Position.Direction).CellId];
                    //Cell destCell = fightActor.PreviousPosition.Cell;
                    FightActor oldFighter = base.Fight.GetOneFighter(destCell);
                    if (oldFighter != null)
                    {
                        //if there was a fighter on the cell we are going to tp on, we need to move him at our old position
                        oldFighter.Position.Cell = base.Caster.Position.Cell;
                        oldFighter.AddTelefragState(base.Caster, base.Spell);
                        base.Caster.AddTelefragState(base.Caster, base.Spell);
                        ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(base.Fight.Clients, base.Caster, oldFighter, base.Caster.Cell);
                    }
                    fightActor.Position.Cell = destCell;
                    ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(base.Fight.Clients, base.Caster, fightActor, destCell);
                }
            }
            return(true);
        }
示例#8
0
        void ReviveActor(FightActor actor, int heal)
        {
            var cell = TargetedCell;

            if (!Fight.IsCellFree(cell))
            {
                cell = Map.GetRandomAdjacentFreeCell(TargetedPoint, true);
            }

            actor.Revive(heal, Caster);
            actor.SummoningEffect = this;
            actor.Position.Cell   = cell;
            actor.BuffRemoved    += OnBuffRemoved;

            if (Spell.Id == (int)SpellIdEnum.LAISSE_SPIRITUELLE_420)
            {
                var actorBuffId = actor.PopNextBuffId();

                var addStateHandler = new AddState(new EffectDice(EffectsEnum.Effect_AddState, (short)SpellStatesEnum.ZOMBI_74, 0, 0), actor, null, actor.Cell, false);
                var actorBuff       = new StateBuff(actorBuffId, actor, Caster, addStateHandler,
                                                    Spell, FightDispellableEnum.DISPELLABLE_BY_DEATH, SpellManager.Instance.GetSpellState((uint)SpellStatesEnum.ZOMBI_74))
                {
                    Duration = -1000
                };

                actor.AddBuff(actorBuff, true);
            }

            ActionsHandler.SendGameActionFightReviveMessage(Fight.Clients, Caster, actor);
            ContextHandler.SendGameFightTurnListMessage(Fight.Clients, Fight);
        }
示例#9
0
        public override void Execute()
        {
            base.Execute();

            Caster.SpellHistory.RegisterCastedSpell(new SpellHistoryEntry(Caster.SpellHistory, Spell.CurrentSpellLevel,
                                                                          Caster, Caster, Fight.TimeLine.RoundNumber, 63));
            ActionsHandler.SendGameActionFightSpellCooldownVariationMessage(Caster.Fight.Clients, Caster, Caster, Spell, 63);
        }
示例#10
0
 public override bool Apply()
 {
     base.Caster.Position.Cell = base.TargetedCell;
     base.Fight.ForEach(delegate(Character entry)
     {
         ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(entry.Client, base.Caster, base.Caster, base.TargetedCell);
     });
     return(true);
 }
示例#11
0
        public override bool Apply()
        {
            SummonedClone summonedClone = new SummonedClone((int)base.Fight.GetNextContextualId(), base.Caster, base.TargetedCell);

            ActionsHandler.SendGameActionFightSummonMessage(base.Fight.Clients, summonedClone);
            base.Caster.AddSummon(summonedClone);
            base.Caster.Team.AddFighter(summonedClone);
            return(true);
        }
示例#12
0
        protected override bool InternalApply()
        {
            var monster = MonsterManager.Instance.GetMonsterGrade(Dice.DiceNum, Dice.DiceFace);

            if (monster == null)
            {
                logger.Error("Cannot summon monster {0} grade {1} (not found)", Dice.DiceNum, Dice.DiceFace);
                return(false);
            }

            if (monster.Template.UseSummonSlot && !Caster.CanSummon())
            {
                return(false);
            }

            SummonedFighter summon;

            if (monster.Template.Id == (int)MonsterIdEnum.HARPONNEUSE_3287 || monster.Template.Id == (int)MonsterIdEnum.GARDIENNE_3288 || monster.Template.Id == (int)MonsterIdEnum.TACTIRELLE_3289)
            {
                summon = new SummonedTurret(Fight.GetNextContextualId(), Caster, monster, Spell, TargetedCell)
                {
                    SummoningEffect = this
                }
            }
            ;
            else if (monster.Template.Id == (int)MonsterIdEnum.COFFRE_ANIME_285)
            {
                summon = new LivingChest(Fight.GetNextContextualId(), Caster.Team, Caster, monster, TargetedCell)
                {
                    SummoningEffect = this
                }
            }
            ;
            else
            {
                summon = new SummonedMonster(Fight.GetNextContextualId(), Caster.Team, Caster, monster, TargetedCell)
                {
                    SummoningEffect = this
                }
            };

            if (Effect.Id == (short)EffectsEnum.Effect_SummonSlave && Caster is CharacterFighter)
            {
                summon.SetController(Caster as CharacterFighter);
            }

            ActionsHandler.SendGameActionFightSummonMessage(Fight.Clients, summon);

            Caster.AddSummon(summon);
            Caster.Team.AddFighter(summon);

            Fight.TriggerMarks(summon.Cell, summon, TriggerType.MOVE);

            return(true);
        }
    }
示例#13
0
        protected override bool InternalApply()
        {
            var orientation = CastPoint.OrientationTo(TargetedPoint);
            var target      = Fight.GetFirstFighter <FightActor>(entry => entry.Position.Cell.Id == CastPoint.GetCellInDirection(orientation, 1).CellId);

            if (target == null)
            {
                return(false);
            }

            if (!target.CanBePushed())
            {
                return(false);
            }

            var startCell = target.Cell;
            var endCell   = TargetedCell;
            var cells     = new MapPoint(startCell).GetCellsOnLineBetween(TargetedPoint);

            for (var index = 0; index < cells.Length; index++)
            {
                var cell = cells[index];
                if (!Fight.IsCellFree(Fight.Map.Cells[cell.CellId]))
                {
                    endCell = index > 0 ? Fight.Map.Cells[cells[index - 1].CellId] : startCell;
                    break;
                }

                if (!Fight.ShouldTriggerOnMove(Fight.Map.Cells[cell.CellId], target))
                {
                    continue;
                }

                endCell = Fight.Map.Cells[cell.CellId];
                break;
            }

            if (target.IsCarrying())
            {
                target.ThrowActor(Map.Cells[startCell.Id], true);
            }

            if (target.IsAlive())
            {
                foreach (var character in Fight.GetCharactersAndSpectators().Where(target.IsVisibleFor))
                {
                    ActionsHandler.SendGameActionFightSlideMessage(character.Client, Caster, target, startCell.Id, endCell.Id);
                }
            }

            target.Cell = endCell;
            target.TriggerBuffs(Caster, BuffTriggerType.OnMoved);

            return(true);
        }
示例#14
0
 public override bool Apply()
 {
     EffectInteger effectInteger = this.GenerateEffect();
     bool flag;
     if (effectInteger == null)
     {
         flag = false;
     }
     else
     {
         foreach (FightActor target in this.GetAffectedActors())
         {
             if (target.CanBeMove())
             {
                 MapPoint point1 = this.TargetedCell.Id != target.Cell.Id ? this.TargetedPoint : new MapPoint(this.CastCell);
                 if (point1.CellId != target.Position.Cell.Id)
                 {
                     DirectionsEnum direction = target.Position.Point.OrientationTo(point1, false);
                     MapPoint point2 = target.Position.Point;
                     MapPoint mapPoint1 = point2;
                     for (int index = 0; index < effectInteger.Value; ++index)
                     {
                         MapPoint nearestCellInDirection = mapPoint1.GetNearestCellInDirection(direction);
                         if (nearestCellInDirection != null)
                         {
                             if (!this.Fight.ShouldTriggerOnMove(this.Fight.Map.Cells[nearestCellInDirection.CellId]))
                             {
                                 if (this.Fight.IsCellFree(this.Map.Cells[nearestCellInDirection.CellId]))
                                 {
                                     mapPoint1 = nearestCellInDirection;
                                 }
                                 else
                                 {
                                     break;
                                 }
                             }
                             else
                             {
                                 mapPoint1 = nearestCellInDirection;
                                 break;
                             }
                         }
                         else
                             break;
                     }
                     MapPoint mapPoint2 = mapPoint1;
                     target.Position.Cell = this.Map.Cells[(int)mapPoint2.CellId];
                     ActionsHandler.SendGameActionFightSlideMessage((IPacketReceiver)this.Fight.Clients, this.Caster, target, point2.CellId, mapPoint2.CellId);
                 }
             }
         }
         flag = true;
     }
     return flag;
 }
示例#15
0
        public override bool Apply()
        {
            EffectInteger integer = base.GenerateEffect();

            if (integer == null)
            {
                return(false);
            }
            foreach (FightActor actor in base.GetAffectedActors())
            {
                if (actor.CanBeMove())
                {
                    MapPoint   startCell;
                    MapPoint   endCell;
                    FightActor actorCopy;
                    MapPoint   point = (base.TargetedCell.Id == actor.Cell.Id) ? new MapPoint(base.CastCell) : base.TargetedPoint;
                    if (point.CellId != actor.Position.Cell.Id)
                    {
                        DirectionsEnum direction = point.OrientationTo(actor.Position.Point, false);
                        startCell = actor.Position.Point;
                        MapPoint point2 = startCell;
                        for (int i = 0; i < integer.Value; i++)
                        {
                            MapPoint nearestCellInDirection = point2.GetNearestCellInDirection(direction);
                            if (nearestCellInDirection == null)
                            {
                                break;
                            }
                            if (base.Fight.ShouldTriggerOnMove(base.Fight.Map.Cells[nearestCellInDirection.CellId]))
                            {
                                point2 = nearestCellInDirection;
                                break;
                            }
                            if ((nearestCellInDirection == null) || !base.Fight.IsCellFree(base.Map.Cells[nearestCellInDirection.CellId]))
                            {
                                int damage = (8 + (new AsyncRandom().Next(1, 8) * (base.Caster.Level / 50))) * (integer.Value - i);
                                actor.InflictDirectDamage(damage, base.Caster);
                                break;
                            }
                            point2 = nearestCellInDirection;
                        }
                        endCell   = point2;
                        actorCopy = actor;
                        base.Fight.ForEach(delegate(Character entry)
                        {
                            ActionsHandler.SendGameActionFightSlideMessage(entry.Client, this.Caster, actorCopy, startCell.CellId, endCell.CellId);
                        });
                        actor.Position.Cell = base.Map.Cells[endCell.CellId];
                    }
                }
            }
            return(true);
        }
示例#16
0
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                var integerEffect = GenerateEffect();

                if (integerEffect == null)
                {
                    return(false);
                }

                var value = 0;

                for (var i = 0; i < integerEffect.Value && value < actor.MP; i++)
                {
                    if (actor.RollMPLose(Caster, value))
                    {
                        value++;
                    }
                }

                var dodged = (short)(integerEffect.Value - value);

                if (dodged > 0)
                {
                    ActionsHandler.SendGameActionFightDodgePointLossMessage(Fight.Clients,
                                                                            ActionsEnum.ACTION_FIGHT_SPELL_DODGED_PM, Caster, actor, dodged);
                }

                if (value <= 0)
                {
                    return(false);
                }

                actor.LostMP((short)value, Caster);
                actor.TriggerBuffs(actor, BuffTriggerType.OnMPLost);

                if (Effect.Duration != 0 || Effect.Delay != 0)
                {
                    AddStatBuff(Caster, (short)(value), PlayerFields.MP, (short)EffectsEnum.Effect_AddMP_128);
                }
                else
                {
                    Caster.RegainMP((short)(value));
                }
            }

            return(true);
        }
示例#17
0
        public override bool Apply()
        {
            bool result;

            foreach (FightActor current in base.GetAffectedActors())
            {
                EffectInteger effectInteger = base.GenerateEffect();
                if (effectInteger == null)
                {
                    result = false;
                    return(result);
                }
                short num = effectInteger.Value;
                if (this.Effect.EffectId != EffectsEnum.Effect_LosingMP)
                {
                    num = 0;
                    int num2 = 0;
                    while (num2 < (int)effectInteger.Value && (int)num < current.MP)
                    {
                        if (current.RollMPLose(base.Caster))
                        {
                            num += 1;
                        }
                        num2++;
                    }
                    short num3 = Convert.ToInt16(effectInteger.Value - num);
                    if (num3 > 0)
                    {
                        ActionsHandler.SendGameActionFightDodgePointLossMessage(base.Fight.Clients, ActionsEnum.ACTION_FIGHT_SPELL_DODGED_PM, base.Caster, current, num3);
                    }
                }
                if (num <= 0)
                {
                    result = false;
                    return(result);
                }
                if (this.Effect.Duration > 1)
                {
                    base.AddStatBuff(current, Convert.ToInt16(-num), PlayerFields.MP, true);
                }
                else
                {
                    current.LostMP(num);
                }
            }
            result = true;
            return(result);
        }
示例#18
0
 public override bool Apply()
 {
     System.Collections.Generic.IEnumerable <FightActor> allFighters = base.Fight.GetAllFighters((FightActor f) => f.IsAlive());
     foreach (FightActor current in allFighters)
     {
         Cell       cell       = current.FightStartPosition.Cell;
         FightActor oneFighter = base.Fight.GetOneFighter(cell);
         if (oneFighter != null)
         {
             this.MoveOldFighter(oneFighter);
         }
         current.Position.Cell = cell;
         ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(base.Fight.Clients, base.Caster, current, cell);
     }
     return(true);
 }
示例#19
0
        private void TriggerBuff(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var spellId  = Dice.DiceNum;
            var cooldown = Dice.Value;

            var spell = buff.Target.GetSpell(spellId);

            if (spell == null)
            {
                return;
            }

            buff.Target.SpellHistory.RegisterCastedSpell(new SpellHistoryEntry(buff.Target.SpellHistory, spell.CurrentSpellLevel,
                                                                               Caster, buff.Target, Fight.TimeLine.RoundNumber, cooldown));
            ActionsHandler.SendGameActionFightSpellCooldownVariationMessage(buff.Target.Fight.Clients, Caster, buff.Target, spell, cooldown);
        }
示例#20
0
文件: Double.cs 项目: Mixi59/Stump
        protected override bool InternalApply()
        {
            var summon = new SummonedClone(Fight.GetNextContextualId(), Caster, TargetedCell)
            {
                SummoningEffect = this
            };

            Caster.AddSummon(summon);
            Caster.Team.AddFighter(summon);

            ActionsHandler.SendGameActionFightSummonMessage(Fight.Clients, summon);

            Fight.TriggerMarks(summon.Cell, summon, TriggerType.MOVE);

            return(true);
        }
示例#21
0
文件: MPDebuff.cs 项目: Mixi59/Stump
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                if (IsTriggerBuff())
                {
                    AddTriggerBuff(actor, TriggerBuff);
                }
                else
                {
                    var integerEffect = GenerateEffect();

                    if (integerEffect == null)
                    {
                        return(false);
                    }

                    var value = Effect.EffectId == EffectsEnum.Effect_SubMP ? integerEffect.Value : RollMP(actor, integerEffect.Value);

                    var dodged = (short)(integerEffect.Value - value);

                    if (dodged > 0)
                    {
                        ActionsHandler.SendGameActionFightDodgePointLossMessage(Fight.Clients,
                                                                                ActionsEnum.ACTION_FIGHT_SPELL_DODGED_PM, Caster, actor, dodged);
                    }

                    if (value <= 0)
                    {
                        continue;
                    }

                    actor.TriggerBuffs(actor, BuffTriggerType.OnMPLost);

                    if (Effect.Duration != 0 || Effect.Delay != 0 && Effect.EffectId != EffectsEnum.Effect_LostMP)
                    {
                        AddStatBuff(actor, (short)-value, PlayerFields.MP, (short)EffectsEnum.Effect_SubMP);
                    }
                    else
                    {
                        actor.LostMP(value, Caster);
                    }
                }
            }

            return(true);
        }
示例#22
0
        protected override bool InternalApply()
        {
            var carryingActor = Caster.GetCarryingActor();

            if (carryingActor != null)
            {
                carryingActor.ThrowActor(TargetedCell);
            }
            else
            {
                Caster.Position.Cell = TargetedCell;

                Fight.ForEach(entry => ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(entry.Client, Caster, Caster, TargetedCell), true);
            }

            return(true);
        }
示例#23
0
        protected override void OnDead(FightActor killedBy, bool passTurn = true)
        {
            Fight.TurnStarted        -= OnTurnStarted;
            Summoner.DamageInflicted -= OnCasterDamageInflicted;

            using (Fight.StartSequence(SequenceTypeEnum.SEQUENCE_SPELL))
            {
                ActionsHandler.SendGameActionFightVanishMessage(Fight.Clients, Summoner, this);

                Summoner.RemoveSummon(this);

                if (!Summoner.Summons.Any(x => x is SummonedImage))
                {
                    Summoner.SetInvisibilityState(GameActionFightInvisibilityStateEnum.VISIBLE);
                }
            }
        }
        public override bool Apply()
        {
            bool result;

            foreach (FightActor current in base.GetAffectedActors())
            {
                EffectInteger effectInteger = base.GenerateEffect();
                if (effectInteger == null)
                {
                    result = false;
                    return(result);
                }
                int num  = 0;
                int num2 = 0;
                while (num2 < (int)effectInteger.Value && num < current.AP)
                {
                    if (current.RollAPLose(base.Caster))
                    {
                        num++;
                    }
                    num2++;
                }
                short num3 = (short)((int)effectInteger.Value - num);
                if (num3 > 0)
                {
                    ActionsHandler.SendGameActionFightDodgePointLossMessage(base.Fight.Clients, ActionsEnum.ACTION_FIGHT_SPELL_DODGED_PA, base.Caster, current, num3);
                }
                if (num <= 0)
                {
                    result = false;
                    return(result);
                }
                base.AddStatBuff(current, (short)(-(short)num), PlayerFields.AP, true, 168);
                if (this.Effect.Duration > 0)
                {
                    base.AddStatBuff(base.Caster, (short)num, PlayerFields.AP, true, 111);
                }
                else
                {
                    base.Caster.RegainAP((short)num);
                }
            }
            result = true;
            return(result);
        }
示例#25
0
文件: Rewind.cs 项目: Mixi59/Stump
        public void TriggerBuffApply(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var dstCell = buff.Target.TurnStartPosition.Cell;
            var fighter = Fight.GetOneFighter(dstCell);

            if (fighter != null)
            {
                if (!fighter.IsImmuneToSpell(Spell.Id))
                {
                    buff.Target.Telefrag(Caster, fighter);
                }
            }
            else
            {
                buff.Target.Position.Cell = dstCell;

                ActionsHandler.SendGameActionFightTeleportOnSameMapMessage(buff.Target.Fight.Clients, Caster, buff.Target, buff.Target.Position.Cell);
            }
        }
示例#26
0
        public void EndSequence()
        {
            if (Ended)
            {
                return;
            }

            // check every children has been ended
            foreach (var child in Children)
            {
                child.EndSequence();
            }

            Ended = true;
            Fight.OnSequenceEnded(this);

            if (Parent == null)
            {
                ActionsHandler.SendSequenceEndMessage(Fight.Clients, this);
            }
        }
        public override bool Apply()
        {
            var target = this.Caster.Team.GetOneTree(this.TargetedCell);

            if (target != null && target.Summoner.Id == this.Caster.Id && target.HasState((int)SpellStatesEnum.Leafy))
            {
                var monsterGrade = Singleton <MonsterManager> .Instance.GetMonsterGrade(base.Dice.DiceNum, this.Spell.CurrentLevel);

                var summonedMonster = new SummonedMonster(this.Fight.GetNextContextualId(), this.Caster.Team, this.Caster, monsterGrade, target.Cell, true, true);
                target.Die();

                this.Caster.AddSummon(summonedMonster);
                this.Caster.Team.AddFighter(summonedMonster);

                ActionsHandler.SendGameActionFightSummonMessage(base.Fight.Clients, summonedMonster);

                return(true);
            }

            return(false);
        }
示例#28
0
        public PsaMovesetHandler(PsaFile psaFile)
        {
            PsaFile             = psaFile;
            AttributesHandler   = new AttributesParser(PsaFile);
            DataTableHandler    = new DataTableHandler(PsaFile);
            ExternalDataHandler = new ExternalDataHandler(PsaFile);
            int    dataSectionLocation = DataTableHandler.GetDataTableEntryByName("data").Location;
            string movesetBaseName     = GetMovesetBaseName();

            int numberOfSpecialActions          = (PsaFile.DataSection[dataSectionLocation + 10] - PsaFile.DataSection[dataSectionLocation + 9]) / 4;
            int codeBlockDataStartLocation      = 2014 + numberOfSpecialActions * 2;
            PsaCommandHandler psaCommandHandler = new PsaCommandHandler(psaFile, dataSectionLocation, codeBlockDataStartLocation);
            CodeBlocksHandler codeBlocksHandler = new CodeBlocksHandler(psaFile, dataSectionLocation, psaCommandHandler);

            ActionsHandler         = new ActionsHandler(PsaFile, dataSectionLocation, codeBlocksHandler, psaCommandHandler);
            SubActionsHandler      = new SubActionsHandler(PsaFile, dataSectionLocation, codeBlocksHandler, psaCommandHandler);
            SubRoutinesHandler     = new SubRoutinesHandler(PsaFile, dataSectionLocation, ActionsHandler, SubActionsHandler, psaCommandHandler);
            ActionOverridesHandler = new ActionOverridesHandler(PsaFile, dataSectionLocation, ActionsHandler, psaCommandHandler);
            ArticlesHandler        = new ArticlesHandler(PsaFile, dataSectionLocation, movesetBaseName, psaCommandHandler);
            CharacterParamsHandler = new CharacterParamsHandler(PsaFile, dataSectionLocation, movesetBaseName, psaCommandHandler);
            MiscHandler            = new MiscHandler(PsaFile, dataSectionLocation, movesetBaseName, numberOfSpecialActions);
        }
示例#29
0
        private void TriggerBuff(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var integerEffect = GenerateEffect();

            if (integerEffect == null)
            {
                return;
            }

            var value = Effect.EffectId == EffectsEnum.Effect_SubAP ? integerEffect.Value : RollAP(buff.Target, integerEffect.Value);

            var dodged = (short)(integerEffect.Value - value);

            if (dodged > 0)
            {
                ActionsHandler.SendGameActionFightDodgePointLossMessage(Fight.Clients,
                                                                        ActionsEnum.ACTION_FIGHT_SPELL_DODGED_PA, Caster, buff.Target, dodged);
            }

            if (value <= 0)
            {
                return;
            }

            buff.Target.TriggerBuffs(buff.Target, BuffTriggerType.OnAPLost);

            if (Effect.Duration != 0 || Effect.Delay != 0 && Effect.EffectId != EffectsEnum.Effect_LostAP)
            {
                var newBuff = AddStatBuffDirectly(buff.Target, (short)-value, PlayerFields.AP, (short)EffectsEnum.Effect_SubAP, triggerrer: triggerrer);
                if (TriggeredBuffDuration > 0)
                {
                    newBuff.Duration = (short)TriggeredBuffDuration;
                }
            }
            else
            {
                buff.Target.LostAP(value, Caster);
            }
        }
示例#30
0
        protected override bool InternalApply()
        {
            var bombSpell       = SpellManager.Instance.GetSpellBombTemplate(Dice.DiceNum);
            var monsterTemplate = MonsterManager.Instance.GetMonsterGrade(Dice.DiceNum, Dice.DiceFace);

            var targets = GetAffectedActors();

            if (targets.Any())
            {
                var spell = new Spell(bombSpell.InstantReactionSpell, Spell.CurrentLevel);
                var cast  = SpellManager.Instance.GetSpellCastHandler(Caster, spell, TargetedCell, Critical);

                cast.Initialize();
                cast.Execute();
            }
            else
            {
                if (!Caster.CanSummonBomb())
                {
                    return(false);
                }

                var bomb = new SummonedBomb(Fight.GetNextContextualId(), Caster.Team, bombSpell, monsterTemplate, Caster,
                                            TargetedCell)
                {
                    SummoningEffect = this
                };

                ActionsHandler.SendGameActionFightSummonMessage(Fight.Clients, bomb);

                Caster.AddBomb(bomb);
                Caster.Team.AddFighter(bomb);

                Fight.TriggerMarks(bomb.Cell, bomb, TriggerType.MOVE);
            }

            return(false);
        }
		public BaseUpdateBuilder(IDbProvider provider, IDbCommand command, string name)
		{
			Data =  new BuilderData(command, name);
			Actions = new ActionsHandler(Data);
		}
		public BaseDeleteBuilder(IDbCommand command, string name)
		{
			Data =  new BuilderData(command, name);
			Actions = new ActionsHandler(Data);
		}