Пример #1
0
        public Spell(String name, String fxName, String animName,
                     float timePerMana, int DamagePerLevel, DamageTypes DamgeType, SPELL_TYPE SpellType,
                     bool CanTurnDuringInvest, bool CanChangeTargetDuringInvest, bool isMultiEffect,
                     SPELL_TARGET_COLLECT TargetCollectAlgo, SPELL_TARGET_TYPES TargetCollectType,
                     int TargetCollectRange, int TargetCollectAzi, int TargetCollectElev,
                     int[] chargeMana)
            : this()
        {
            if (chargeMana == null)
            {
                throw new ArgumentException("chargeMana can not be null!");
            }
            spell.processMana = chargeMana;
            spell.Name        = name;
            spell.FXName      = fxName;
            spell.AniName     = animName;

            spell.TimePerMana                 = timePerMana;
            spell.DamagePerLevel              = DamagePerLevel;
            spell.DamageType                  = DamgeType;
            spell.SpellType                   = SpellType;
            spell.CanTurnDuringInvest         = CanTurnDuringInvest;
            spell.CanChangeTargetDuringInvest = CanChangeTargetDuringInvest;
            spell.isMultiEffect               = isMultiEffect;
            spell.TargetCollectionAlgo        = TargetCollectAlgo;
            spell.TargetCollectType           = TargetCollectType;
            spell.TargetCollectRange          = TargetCollectRange;
            spell.TargetCollectAzi            = TargetCollectAzi;
            spell.TargetCollectElev           = TargetCollectElev;



            CreateSpell();
        }
Пример #2
0
        public void CastSpell(SPELL_TYPE spellType_, int level_, float x_, float y_)
        {
            Spell spell = new Spell(spellType_, level_, x_, y_);

            spell.Texture = gameAssets.SpellTextureList[(int)spellType_];
            gameAssets.SpellListAdd(spell);
        }
Пример #3
0
 public void SetActiveSpell(SPELL_TYPE type_)
 {
     for (int i = 0; i < gameAssets_.GUIListCount; i++)
     {
         if (i == (int)type_)
         {
             gameAssets_.GUIListItem(i).Active = true;
         }
         else if (i < 5) //hack temp fix
         {
             gameAssets_.GUIListItem(i).Active = false;
         }
     }
 }
Пример #4
0
 public void SetSpell(string name       = "Base Spell", float _power = 0, float _coolDown       = .1f, float _castTime = .1f, float _duration = 1, float _resourceCost = 10, float _interval = 0.0f,
                      bool _isStackable = false, string _path        = "", SPELL_SCHOOL _school = SPELL_SCHOOL.BASE, SPELL_TYPE _spellType = SPELL_TYPE.HEAL,
                      CLASS_SPECIFIC_TYPE _classType = CLASS_SPECIFIC_TYPE.ALL)
 {
     power        = _power;
     displayName  = name;
     coolDown     = _coolDown;
     castTime     = _castTime;
     duration     = _duration;
     interval     = _interval;
     resourceCost = _resourceCost;
     isStackable  = _isStackable;
     spellSchool  = _school;
     spellType    = _spellType;
     classType    = _classType;
     imagePath    = _path;
 }
Пример #5
0
 public SpellInfo(SPELL _id, string _name, int _basevalue, float _coeff, int _basevalue2,
                  float _coeff2, int _castTime, int _cooldown, int _charges, int _chargesGain,
                  string _icon, int _HoTgap, int _ticksCount, int _manaCost, HEALTYPE _healtype, bool _channeling, SpellEffect _effect, SPELL_TYPE _spellType)
 {
     ID          = _id;
     name        = _name;
     baseValue   = _basevalue;
     coeff       = _coeff;
     baseValue2  = _basevalue2;
     coeff2      = _coeff2;
     castTime    = _castTime;
     cooldown    = _cooldown;
     charges     = _charges;
     chargesGain = _chargesGain;
     icon        = _icon;
     HoTgap      = _HoTgap;
     ticksCount  = _ticksCount;
     manaCost    = _manaCost;
     healtype    = _healtype;
     channeling  = _channeling;
     effect      = _effect;
     spellType   = _spellType;
 }
Пример #6
0
        //happy to leave this hardcoded for now rather than using const vars
        //at least it is neat and everything is in the same spot.
        //eventually want to database drive this.
        private void InitialiseEnemyVariables()
        {
            switch (enemyType)
            {
            case ENEMY_TYPE.GHOUL:
                health   = 6;
                speed    = 0.01f;
                weakness = SPELL_TYPE.FIREBALL;
                cost     = 10;
                essence  = cost;
                break;

            case ENEMY_TYPE.RUNNING_GHOUL:
                health   = 3;
                speed    = 0.02f;
                weakness = SPELL_TYPE.FIREBALL;
                cost     = 20;
                essence  = cost;
                break;

            case ENEMY_TYPE.HEAVY_ZOMBIE:
                health     = 11;
                speed      = 0.025f;
                weakness   = SPELL_TYPE.FIREBALL;
                resistance = SPELL_TYPE.LIGHTNING;
                cost       = 30;
                essence    = cost;
                break;

            case ENEMY_TYPE.SKELETON_KNIGHT:
                health     = 15;
                speed      = 0.03f;
                weakness   = SPELL_TYPE.RAPTURE;
                resistance = SPELL_TYPE.DESPAIR;
                cost       = 40;
                essence    = cost;
                break;

            case ENEMY_TYPE.OGRE:
                health     = 15;
                speed      = 0.035f;
                weakness   = SPELL_TYPE.ICELANCE;
                resistance = SPELL_TYPE.FIREBALL;
                cost       = 80;
                essence    = cost;
                break;

            case ENEMY_TYPE.WEREWOLF:
                health     = 18;
                speed      = 0.04f;
                weakness   = SPELL_TYPE.ICELANCE;
                resistance = SPELL_TYPE.FIREBALL;
                cost       = 160;
                essence    = cost;
                break;

            case ENEMY_TYPE.GREEN_DRAGON:
                health     = 25;
                speed      = 0.05f;
                weakness   = SPELL_TYPE.RAPTURE;
                resistance = SPELL_TYPE.DESPAIR;
                cost       = 320;
                essence    = cost;
                break;
            }
        }
Пример #7
0
        void SpellManagement()
        {
            //set all existing on screen spells Initialhit=false
            for (int i = 0; i < gameAssets_.SpellListCount; i++)
            {
                gameAssets_.SpellListItem(i).InitialHitFinished();
            }

            //Click to cast
            if (Keyboard.GetState().IsKeyDown(Keys.D1))
            {
                spellSelect = SPELL_TYPE.FIREBALL;
                SetActiveSpell(SPELL_TYPE.FIREBALL);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D2))
            {
                spellSelect = SPELL_TYPE.ICELANCE;
                SetActiveSpell(SPELL_TYPE.ICELANCE);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D3))
            {
                spellSelect = SPELL_TYPE.LIGHTNING;
                SetActiveSpell(SPELL_TYPE.LIGHTNING);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D4))
            {
                spellSelect = SPELL_TYPE.DESPAIR;
                SetActiveSpell(SPELL_TYPE.DESPAIR);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D5))
            {
                spellSelect = SPELL_TYPE.RAPTURE;
                SetActiveSpell(SPELL_TYPE.RAPTURE);
            }

            if (Mouse.GetState().LeftButton == ButtonState.Pressed && !leftMouseButtonDown)
            {
                leftMouseButtonDown = true;
                bool GUIElementClicked = false;
                //Get Mouse position in viewport
                Vector2 mousePos = new Vector2(Mouse.GetState().X - viewPort_.X, Mouse.GetState().Y - viewPort_.Y);

                for (int i = 0; i < gameAssets_.GUIListCount; i++)
                {
                    if (colliderHandler_.Collider(gameAssets_.GUIListItem(i), mousePos) && gameAssets_.GUIListItem(i).Active)
                    {
                        //Logic for GUI Element depending on type
                        //Tower - Upgrades?
                        //Spellbook - spell book
                        //hotbar - select
                        //Debug.WriteLine("PING" + gameTime.TotalGameTime);
                        GUIElementClicked = true;
                    }
                }

                if (!GUIElementClicked && !gameAssets_.TowerListItem(0).SpellCast&& activeSpellCDs[(int)spellSelect] <= 0)
                {
                    //We must iterate through current active spell list to see whether the selected spell is currently on cooldown. (may change)
                    int spellX = Mouse.GetState().X - viewPort_.X;
                    int spellY = Mouse.GetState().Y - viewPort_.Y;

                    //Debug.WriteLine("X" + spellX + "Y" + spellY);

                    objectFactory_.CastSpell(spellSelect, gameAssets_.TowerListItem(0).SpellLevel[(int)spellSelect], spellX, spellY);
                    //Player has cast a spell - intiate global cooldown
                    gameAssets_.TowerListItem(0).SpellCast = true;
                    leftMouseButtonDown = true;

                    //Add cooldown time to list
                    activeSpellCDs[(int)spellSelect] = gameAssets_.SpellListItem((int)gameAssets_.SpellListCount - 1).SpellCooldown;
                }
            }



            //Iterate over cooldownlist - if anything > 0 we need to count it down
            for (int i = 0; i < activeSpellCDs.Count; i++)
            {
                if (activeSpellCDs[i] > 0)
                {
                    activeSpellCDs[i] -= 5;                    //Hack - incorporate timers later
                    if (activeSpellCDs[i] <= 0)
                    {
                        //    Debug.WriteLine("Spell is now ready for use: " + Enum.GetNames(typeof(SPELL_TYPE)).ElementAt(i));
                    }
                }

                if (activeSpellCDs[i] < 0)
                {
                    activeSpellCDs[i] = 0;
                }
            }

            if (Mouse.GetState().LeftButton == ButtonState.Released)
            {
                leftMouseButtonDown = false;
            }
        }
Пример #8
0
 public void CastSpell(SPELL_TYPE spellType_, int level_, float x_, float y_)
 {
     Spell spell = new Spell(spellType_, level_, x_, y_);
     spell.Texture = gameAssets.SpellTextureList[(int)spellType_];
     gameAssets.SpellListAdd(spell);
 }
Пример #9
0
 public SpellHolder(SPELL_TYPE newSpellType, int newLevel)
 {
     spellType  = newSpellType;
     spellLevel = newLevel;
 }
Пример #10
0
        //Timer damageTimer;

        public Spell(SPELL_TYPE type_, int spellLevel_, float x_, float y_)
        {
            type          = type_;
            spellLevel    = spellLevel_;
            Active        = true;
            Width         = 64;
            Height        = 64;
            initialDamage = 0;

            X = x_;
            Y = y_;

//            Debug.WriteLine("spellX" + X + "spellY" + Y);

            //Set spell to be 'active' - currently being used to control draw time on screen
            activeTime = 500;

            //Split into own functions later
            switch (type)
            {
            case SPELL_TYPE.FIREBALL:
                initialDamage = 100 * (1 + spellLevel * 0.1f);
                break;

            case SPELL_TYPE.ICELANCE:
                initialDamage = 75 * (1 + spellLevel * 0.1f);
                break;

            case SPELL_TYPE.LIGHTNING:
                initialDamage = 30 * (1 + spellLevel * 0.1f);
                break;

            case SPELL_TYPE.DESPAIR:
                initialDamage = 20 * (1 + spellLevel * 0.1f);
                break;

            case SPELL_TYPE.RAPTURE:
                initialDamage = 10 * (1 + spellLevel * 0.1f);
                break;

            default:
                initialDamage = 0;
                break;
            }

            switch (type)
            {
            case SPELL_TYPE.FIREBALL:
                damagePerTick = 0;
                break;

            case SPELL_TYPE.ICELANCE:
                damagePerTick = 0;
                break;

            case SPELL_TYPE.LIGHTNING:
                damagePerTick = initialDamage * 0.03f;
                break;

            case SPELL_TYPE.DESPAIR:
                damagePerTick = initialDamage * 0.03f;
                break;

            case SPELL_TYPE.RAPTURE:
                damagePerTick = initialDamage * 0.03f;
                break;

            default:
                damagePerTick = 0;
                break;
            }

            switch (type)
            {
            case SPELL_TYPE.FIREBALL:
                spellCooldown = 2000;
                break;

            case SPELL_TYPE.ICELANCE:
                spellCooldown = 400;
                break;

            case SPELL_TYPE.LIGHTNING:
                spellCooldown = 300;
                break;

            case SPELL_TYPE.DESPAIR:
                spellCooldown = 200;
                break;

            case SPELL_TYPE.RAPTURE:
                spellCooldown = 100;
                break;

            default:
                spellCooldown = 10;
                break;
            }

            damage = initialDamage;

            //Spell Timer
            activeTimer          = new System.Timers.Timer(1000); //1 second interval
            activeTimer.Elapsed += OnTimedEvent;
            activeTimer.Interval = activeTime;
            activeTimer.Enabled  = true;
            activeTimer.Start();

            ////Spell Damage Timer
            //damageTimer = new System.Timers.Timer(1000);
            //damageTimer.Elapsed += OnTimedEventDamage;
            //damageTimer.Interval = 100; //tick length, 100 milliseconds
            //damageTimer.Enabled = true; //Start enables... why keep putting this in?
            //damageTimer.Start();
        }