Exemple #1
0
        private IEnumerable <TargetCell> ExpandZone(Cell center, SpellShapeEnum shape, int minRange, int maxRange)
        {
            switch (shape)
            {
            case SpellShapeEnum.X:
                return(new CrossSet(new MapPoint(center), maxRange, minRange).
                       EnumerateValidPoints().Select(x => new TargetCell(Fighter.Map.Cells[x.CellId])));

            case SpellShapeEnum.C:
                return(new LozengeSet(new MapPoint(center), maxRange, minRange).
                       EnumerateValidPoints().Select(x => new TargetCell(Fighter.Map.Cells[x.CellId])));

            case SpellShapeEnum.L:
                return(new LineSet(new MapPoint(center).GetCellInDirection(DirectionsEnum.DIRECTION_NORTH_EAST, minRange), maxRange, DirectionsEnum.DIRECTION_NORTH_EAST).
                       EnumerateValidPoints().Select(x => new TargetCell(Fighter.Map.Cells[x.CellId], DirectionFlagEnum.DIRECTION_SOUTH_WEST)).
                       Union(new LineSet(new MapPoint(center).GetCellInDirection(DirectionsEnum.DIRECTION_SOUTH_EAST, minRange),
                                         maxRange, DirectionsEnum.DIRECTION_SOUTH_EAST).EnumerateValidPoints().
                             Select(x => new TargetCell(Fighter.Map.Cells[x.CellId], DirectionFlagEnum.DIRECTION_NORTH_WEST))).
                       Union(new LineSet(new MapPoint(center).GetCellInDirection(DirectionsEnum.DIRECTION_SOUTH_WEST, minRange),
                                         maxRange, DirectionsEnum.DIRECTION_SOUTH_WEST).EnumerateValidPoints().
                             Select(x => new TargetCell(Fighter.Map.Cells[x.CellId], DirectionFlagEnum.DIRECTION_NORTH_EAST))).
                       Union(new LineSet(new MapPoint(center).GetCellInDirection(DirectionsEnum.DIRECTION_NORTH_WEST, minRange),
                                         maxRange, DirectionsEnum.DIRECTION_NORTH_WEST).EnumerateValidPoints().
                             Select(x => new TargetCell(Fighter.Map.Cells[x.CellId], DirectionFlagEnum.DIRECTION_SOUTH_EAST))));

            case SpellShapeEnum.I:
                return(new Complement(new LozengeSet(center, maxRange, minRange), new AllPoints())
                       .EnumerateValidPoints().Select(x => new TargetCell(Fighter.Map.Cells[x.CellId])));

            default:
                return(new[] { new TargetCell(center) });
            }
        }
Exemple #2
0
 public Zone(SpellShapeEnum shape, byte radius, byte minRadius, DirectionsEnum direction, int efficiencyMalus, int maxEfficiency)
 {
     Radius          = radius;
     MinRadius       = minRadius;
     Direction       = direction;
     ShapeType       = shape;
     EfficiencyMalus = efficiencyMalus > 0 ? efficiencyMalus : EFFECTSHAPE_DEFAULT_EFFICIENCY;
     MaxEfficiency   = maxEfficiency > 0 ? maxEfficiency : EFFECTSHAPE_DEFAULT_MAX_EFFICIENCY_APPLY;
 }
Exemple #3
0
 public Glyph(short id, FightActor caster, Spell castedSpell, EffectDice originEffect, Spell glyphSpell,
              Cell centerCell, SpellShapeEnum shape, byte minSize, byte size, Color color, bool canBeForced, TriggerType triggerType = TriggerType.OnTurnBegin)
     : base(id, caster, castedSpell, originEffect, centerCell,
            new MarkShape(caster.Fight, centerCell, shape, GetMarkShape(shape), minSize, size, color))
 {
     GlyphSpell  = glyphSpell;
     CanBeForced = canBeForced;
     Duration    = originEffect.Duration;
     TriggerType = triggerType;
 }
Exemple #4
0
        public MarkShape(IFight fight, Cell cell, SpellShapeEnum spellShape, GameActionMarkCellsTypeEnum shape, byte minSize, byte size, Color color)
        {
            Fight   = fight;
            Cell    = cell;
            Shape   = shape;
            Size    = size;
            MinSize = minSize;
            Color   = color;

            m_zone = new Zone(spellShape, size, MinSize);
            CheckCells(m_zone.GetCells(Cell, fight.Map));
        }
Exemple #5
0
        protected static GameActionMarkCellsTypeEnum GetMarkShape(SpellShapeEnum shape)
        {
            switch (shape)
            {
            case SpellShapeEnum.G:
                return(GameActionMarkCellsTypeEnum.CELLS_SQUARE);

            case SpellShapeEnum.X:
                return(GameActionMarkCellsTypeEnum.CELLS_CROSS);

            default:
                return(GameActionMarkCellsTypeEnum.CELLS_CIRCLE);
            }
        }
        public EffectBase(short id, EffectBase effect)
        {
            this.m_id       = id;
            this.m_template = Singleton <EffectManager> .Instance.GetTemplate(id);

            this.m_targets     = effect.Targets;
            this.m_targetMask  = effect.TargetMask;
            this.m_delay       = effect.Delay;
            this.m_duration    = effect.Duration;
            this.m_group       = effect.Group;
            this.m_random      = effect.Random;
            this.m_modificator = effect.Modificator;
            this.m_trigger     = effect.Trigger;
            this.m_hidden      = effect.Hidden;
            this.m_zoneSize    = effect.m_zoneSize;
            this.m_zoneMinSize = effect.m_zoneMinSize;
            this.m_zoneShape   = effect.ZoneShape;
        }
 protected void ParseRawZone(string rawZone)
 {
     if (string.IsNullOrEmpty(rawZone))
     {
         this.m_zoneShape   = (SpellShapeEnum)0;
         this.m_zoneSize    = 0u;
         this.m_zoneMinSize = 0u;
     }
     else
     {
         SpellShapeEnum zoneShape   = (SpellShapeEnum)rawZone[0];
         byte           zoneSize    = 0;
         byte           zoneMinSize = 0;
         int            num         = rawZone.IndexOf(',');
         try
         {
             if (num == -1 && rawZone.Length > 1)
             {
                 zoneSize = byte.Parse(rawZone.Remove(0, 1));
             }
             else
             {
                 if (rawZone.Length > 1)
                 {
                     zoneSize    = byte.Parse(rawZone.Substring(1, num - 1));
                     zoneMinSize = byte.Parse(rawZone.Remove(0, num + 1));
                 }
             }
         }
         catch (System.Exception)
         {
             this.m_zoneShape   = (SpellShapeEnum)0;
             this.m_zoneSize    = 0u;
             this.m_zoneMinSize = 0u;
             EffectBase.logger.Error("ParseRawZone() => Cannot parse {0}", rawZone);
         }
         this.m_zoneShape   = zoneShape;
         this.m_zoneSize    = (uint)zoneSize;
         this.m_zoneMinSize = (uint)zoneMinSize;
     }
 }
Exemple #8
0
 public EffectBase(EffectBase effect)
 {
     m_id                    = effect.Id;
     m_template              = EffectManager.Instance.GetTemplate(effect.Id);
     m_targets               = effect.Targets;
     m_targetMask            = effect.TargetMask;
     m_delay                 = effect.Delay;
     m_duration              = effect.Duration;
     m_group                 = effect.Group;
     m_random                = effect.Random;
     m_modificator           = effect.Modificator;
     m_trigger               = effect.Trigger;
     m_triggers              = effect.Triggers;
     m_hidden                = effect.Hidden;
     m_zoneSize              = effect.m_zoneSize;
     m_zoneMinSize           = effect.m_zoneMinSize;
     m_zoneShape             = effect.ZoneShape;
     m_zoneMaxEfficiency     = effect.ZoneMaxEfficiency;
     m_zoneEfficiencyPercent = effect.ZoneEfficiencyPercent;
     ParseTargets();
 }
Exemple #9
0
 public Zone(SpellShapeEnum shape, byte radius, byte minRadius)
 {
     Radius    = radius;
     MinRadius = minRadius;
     ShapeType = shape;
 }
Exemple #10
0
 public Rune(short id, FightActor caster, Spell spell, EffectDice originEffect, Spell runeSpell, Cell centerCell, SpellShapeEnum shape, byte minSize, byte size)
     : base(id, caster, spell, originEffect, centerCell, new MarkShape(caster.Fight, centerCell, shape, GetMarkShape(shape), minSize, size, GetRuneColorBySpell(spell)))
 {
     RuneSpell = runeSpell;
     Duration  = originEffect.Duration;
 }
Exemple #11
0
 public Zone(SpellShapeEnum shape, byte radius, DirectionsEnum direction)
 {
     Radius = radius;
     Direction = direction;
     ShapeType = shape;
 }
Exemple #12
0
 public Zone(SpellShapeEnum shape, byte radius)
 {
     Radius = radius;
     ShapeType = shape;
 }
Exemple #13
0
 public Zone(SpellShapeEnum shape, byte radius)
 {
     this.Radius    = radius;
     this.ShapeType = shape;
 }
Exemple #14
0
        protected void ParseRawZone(string rawZone)
        {
            if (string.IsNullOrEmpty(rawZone))
            {
                m_zoneShape   = 0;
                m_zoneSize    = 0;
                m_zoneMinSize = 0;
                return;
            }

            var  shape             = (SpellShapeEnum)rawZone[0];
            byte size              = 0;
            byte minSize           = 0;
            int  zoneEfficiency    = 0;
            int  zoneMaxEfficiency = 0;

            var data       = rawZone.Remove(0, 1).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            var hasMinSize = shape == SpellShapeEnum.C || shape == SpellShapeEnum.X || shape == SpellShapeEnum.Q || shape == SpellShapeEnum.plus || shape == SpellShapeEnum.sharp;


            try
            {
                if (data.Length >= 4)
                {
                    size              = byte.Parse(data[0]);
                    minSize           = byte.Parse(data[1]);
                    zoneEfficiency    = byte.Parse(data[2]);
                    zoneMaxEfficiency = byte.Parse(data[2]);
                }
                else
                {
                    if (data.Length >= 1)
                    {
                        size = byte.Parse(data[0]);
                    }

                    if (data.Length >= 2)
                    {
                        if (hasMinSize)
                        {
                            minSize = byte.Parse(data[1]);
                        }
                        else
                        {
                            zoneEfficiency = byte.Parse(data[1]);
                        }
                    }

                    if (data.Length >= 3)
                    {
                        if (hasMinSize)
                        {
                            zoneEfficiency = byte.Parse(data[2]);
                        }
                        else
                        {
                            zoneMaxEfficiency = byte.Parse(data[2]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                m_zoneShape   = 0;
                m_zoneSize    = 0;
                m_zoneMinSize = 0;

                logger.Error("ParseRawZone() => Cannot parse {0}", rawZone);
            }

            m_zoneShape             = shape;
            m_zoneSize              = size;
            m_zoneMinSize           = minSize;
            m_zoneEfficiencyPercent = zoneEfficiency;
            m_zoneMaxEfficiency     = zoneMaxEfficiency;
        }
Exemple #15
0
 public GlyphAura(short id, FightActor caster, Spell castedSpell, EffectDice originEffect, Spell glyphSpell, Cell centerCell, SpellShapeEnum shape, byte minSize, byte size, Color color)
     : base(id, caster, castedSpell, originEffect, glyphSpell, centerCell, shape, minSize, size, color, false)
 {
 }
Exemple #16
0
        private void InitializeShape()
        {
            SpellShapeEnum shapeType = this.ShapeType;

            if (shapeType <= SpellShapeEnum.plus)
            {
                if (shapeType == SpellShapeEnum.sharp)
                {
                    this.m_shape = new Cross(1, this.Radius)
                    {
                        Diagonal = true
                    };
                    goto IL_24F;
                }
                switch (shapeType)
                {
                case SpellShapeEnum.star:
                    this.m_shape = new Cross(0, this.Radius)
                    {
                        AllDirections = true
                    };
                    goto IL_24F;

                case SpellShapeEnum.plus:
                    this.m_shape = new Cross(0, this.Radius)
                    {
                        Diagonal = true
                    };
                    goto IL_24F;
                }
            }
            else
            {
                if (shapeType == SpellShapeEnum.slash)
                {
                    this.m_shape = new Line(this.Radius);
                    goto IL_24F;
                }
                switch (shapeType)
                {
                case SpellShapeEnum.A:
                    this.m_shape = new Lozenge(0, 63);
                    goto IL_24F;

                case SpellShapeEnum.C:
                    this.m_shape = new Lozenge(0, this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.D:
                    this.m_shape = new Cross(0, this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.I:
                    this.m_shape = new Lozenge(this.Radius, 63);
                    goto IL_24F;

                case SpellShapeEnum.L:
                    this.m_shape = new Line(this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.O:
                    this.m_shape = new Circle(this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.P:
                    this.m_shape = new Single();
                    goto IL_24F;

                case SpellShapeEnum.Q:
                    this.m_shape = new Cross(1, this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.T:
                    this.m_shape = new Cross(0, this.Radius)
                    {
                        OnlyPerpendicular = true
                    };
                    goto IL_24F;

                case SpellShapeEnum.U:
                    this.m_shape = new HalfLozenge(0, this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.V:
                    this.m_shape = new Cone(0, this.Radius);
                    goto IL_24F;

                case SpellShapeEnum.W:
                    this.m_shape = new Square(0, this.Radius)
                    {
                        DiagonalFree = true
                    };
                    goto IL_24F;

                case SpellShapeEnum.X:
                    this.m_shape = new Cross(0, this.Radius);
                    goto IL_24F;
                }
            }
            this.m_shape = new Cross(0, 0);
IL_24F:
            this.m_shape.Direction = this.Direction;
        }
Exemple #17
0
 public Zone(SpellShapeEnum shape, byte radius, DirectionsEnum direction)
 {
     this.Radius    = radius;
     this.Direction = direction;
     this.ShapeType = shape;
 }
Exemple #18
0
 public Zone(SpellShapeEnum shape, byte radius, DirectionsEnum direction)
 {
     Radius    = radius;
     Direction = direction;
     ShapeType = shape;
 }
Exemple #19
0
 public Trap(short id, FightActor caster, Spell spell, EffectDice originEffect, Spell trapSpell, Cell centerCell, SpellShapeEnum shape, byte minSize, byte size)
     : base(id, caster, spell, originEffect, centerCell, new MarkShape(caster.Fight, centerCell, shape, GetMarkShape(shape), minSize, size, GetTrapColorBySpell(spell)))
 {
     TrapSpell    = trapSpell;
     VisibleState = GameActionFightInvisibilityStateEnum.INVISIBLE;
 }