Example #1
0
 internal void ShowRangedAttack(object attackingMethod, ShowRangedAttackType type, object data, bool targetAtEndPoint)
 {
     RangedAttackEvent(attackingMethod, type, data, targetAtEndPoint);
 }
Example #2
0
        private void HandleRangedAttack(object attackingMethod, ShowRangedAttackType type, object data, bool targetAtEndPoint)
        {
            UpdatePainters();
            ResetHandlerName();
            SendPaintersRequest(new DisableAllOverlays());
            
            TCODColor colorOfBolt = ColorPresets.White;
            
            ISpell attackingSpell = attackingMethod as ISpell;
            if (attackingSpell != null)
                colorOfBolt = SpellGraphicsInfo.GetColorOfSpellFromSchool(attackingSpell.School);

            IItem attackingItem = attackingMethod as IItem;
            if (attackingItem != null)
                colorOfBolt = SpellGraphicsInfo.GetColorOfSpellFromSchool(m_engine.GameState.GetSpellSchoolForItem(attackingItem));

            switch (type)
            {
                case ShowRangedAttackType.RangedBolt:
                {
                    m_painters.HandleRequest(new ShowRangedBolt((List<Point>)data, colorOfBolt, !targetAtEndPoint, 1));
                    m_painters.DrawAnimationSynchronous(m_console);
                    break;
                }
                case ShowRangedAttackType.RangedBlast:
                {
                    m_painters.HandleRequest(new ShowRangedBolt((List<Point>)data, colorOfBolt, true, 3));
                    m_painters.DrawAnimationSynchronous(m_console);
                    break;
                }
                case ShowRangedAttackType.Cone:
                {
                    m_painters.HandleRequest(new ShowConeBlast((List<Point>)data, colorOfBolt));
                    m_painters.DrawAnimationSynchronous(m_console);
                    break;
                }
                case ShowRangedAttackType.RangedExplodingPoint:
                {
                    var animationData = (Pair<List<Point>, List<List<Point>>>)data;
                    m_painters.HandleRequest(new ShowExploadingPoint(animationData.First, animationData.Second, colorOfBolt));
                    m_painters.DrawAnimationSynchronous(m_console);
                    break;
                }
                case ShowRangedAttackType.Stream:
                {
                    List<Point> coveredSquares = (List<Point>)data;
                    Dictionary<Point, bool> occupiedSquares = new Dictionary<Point, bool>(PointEqualityComparer.Instance);
                    
                    foreach (Point p in coveredSquares)
                    {
                        bool occupied = m_engine.Map.Monsters.Any(x => x.Position == p) || m_engine.Map.MapObjects.Any(x => x.Position == p);
                        occupiedSquares.Add(p, occupied);
                    }
                    m_painters.HandleRequest(new ShowStream(coveredSquares, colorOfBolt, occupiedSquares));
                    m_painters.DrawAnimationSynchronous(m_console);
                    break;
                }
            }
        }
Example #3
0
 void RangedAttackEvent(object attackingMethod, ShowRangedAttackType type, object data, bool targetAtEndPoint)
 {
     //throw new NotImplementedException();
 }