Esempio n. 1
0
    private QuestGiver GenerateQuestGiver(Vector3 position, ItemName[] itemRewards, SpellName[] spellRewards)
    {
        QuestGiver qg = Instantiate(m_QuestGiver_Generic).GetComponent <QuestGiver>();

        qg.m_QuestManager     = this;
        qg.m_PlayerInventory  = this.m_Player.GetComponent <PlayerInventory>();
        qg.transform.position = position;
        if (itemRewards != null)
        {
            foreach (ItemName reward in itemRewards)
            {
                ItemClass thisReward = new ItemClass();
                thisReward.GenerateInstance(reward);
                qg.m_RewardItem = thisReward;
            }
        }
        if (spellRewards != null)
        {
            foreach (var reward in spellRewards)
            {
                SpellClass thisReward = new SpellClass();
                thisReward = thisReward.GenerateInstance(reward);
                print(reward);
                print(thisReward.ReturnSpellInstanceInfo());
                qg.m_RewardSpell = thisReward;
            }
        }
        return(qg);
    }
Esempio n. 2
0
    /**A function to set the spell to cast in our parent classes*/
    public override void SetSpellToCast(SpellName spell)
    {
        SpellClass spell_instance = new SpellClass();

        this.m_SpellToCast = spell_instance.GenerateInstance(spell);
        this.m_AttackPattern.m_SpellToCast = this.m_SpellToCast;
    }
Esempio n. 3
0
    }         //end f'n void Update()

    /**A function to reset parameters after each time we pass through this class.*/
    public void ResetParameters()
    {
        this.m_SpellToApply = null;
        this.m_Enemy        = null;
        this.m_SpellTimer   = 0.0f;
        this.m_Iterations   = 0;
    }
Esempio n. 4
0
 public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
                   int _fixedRange, int _perLvlRange,
                   int _fixedDuration, byte _perLvlDuration,
                   byte f6, SpellTargets _targets,
                   DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
                   Affects _affectId, SpellWhen _whenCast,
                   int _castingDelay, int _priority, byte fe, byte ff)
 {
     spellClass     = _spellClass;
     spellLevel     = _spellLevel;
     fixedRange     = _fixedRange;
     perLvlRange    = _perLvlRange;
     fixedDuration  = _fixedDuration;
     perLvlDuration = _perLvlDuration;
     field_6        = f6;
     targetType     = _targets;
     damageOnSave   = _damageOnSave;
     saveVerse      = _saveVerse;
     affect_id      = _affectId;
     whenCast       = _whenCast;
     castingDelay   = _castingDelay;
     priority       = _priority;
     field_E        = fe;
     field_F        = ff;
     spellIdx       = spell_idx;
 }
Esempio n. 5
0
 void Start()
 {
     this.m_Animator         = this.GetComponent <Animator> ();
     this.m_Player           = this.GetComponent <Player> ();
     this.m_SpellClassToFire = this.GetComponent <PlayerInventory> ().m_ActiveSpellClass;
     this.m_playerAudio      = this.GetComponent <PlayerAudio> ();
 }
Esempio n. 6
0
        internal void SetPlayerClass(string player, SpellClass theClass, double currentTime)
        {
            if (!PlayerToClass.TryGetValue(player, out SpellClassCounter counter))
            {
                lock (PlayerToClass)
                {
                    counter = new SpellClassCounter {
                        ClassCounts = new Dictionary <SpellClass, long>()
                    };
                    PlayerToClass.TryAdd(player, counter);
                    AddVerifiedPlayer(player, currentTime);
                }
            }

            lock (counter)
            {
                if (!theClass.Equals(counter.CurrentClass) && counter.CurrentMax != 1000000)
                {
                    counter.CurrentClass          = theClass;
                    counter.ClassCounts[theClass] = 1000000;
                    counter.CurrentMax            = 1000000;
                    LOG.Debug("Assigning " + player + " as " + theClass.ToString() + " from class specific action");
                }
            }
        }
Esempio n. 7
0
 public void ApplySpellEffect(SpellClass spell)
 {
     if (this.m_ExtraEffectsTimer == 0.0f)
     {
         this.m_IsAffectedBySpell    = true;
         this.m_SpellAffectingPlayer = spell;
         if (!spell.m_IsPersistent)
         {
             this.AffectHealth(-spell.m_SpellDamage);
         }
         this.m_ExtraEffectsTimer += Time.deltaTime;
     }
     else if (0.0f < this.m_ExtraEffectsTimer && this.m_ExtraEffectsTimer < spell.m_EffectDuration)
     {
         //Apply whatever needs to happen here
         switch ((int)spell.m_SpellType)
         {
         case (int)SpellType.AOE_ON_TARGET:
         {
             if (spell.m_IsPersistent)
             {
                 this.AffectHealth((-spell.m_SpellDamage / spell.m_EffectDuration) * Time.deltaTime);
             }
             break;
         }
         }
         this.m_ExtraEffectsTimer += Time.deltaTime;
     }
     else if (this.m_ExtraEffectsTimer >= spell.m_EffectDuration)
     {
         this.m_IsAffectedBySpell    = false;
         this.m_SpellAffectingPlayer = null;
         this.m_ExtraEffectsTimer    = 0.0f;
     }
 }
Esempio n. 8
0
    }     //end f'n void SetDirection()

    /**A function to be called from PlayerCastSpell to set the SpellClass that's being cast.*/
    public void SetSpellToCast(SpellClass spell)
    {
        this.m_SpellClassToCast = spell;
        this.m_SpellName        = this.m_SpellClassToCast.m_SpellName.ToString();
        this.m_MaximalVelocity  = this.m_SpellClassToCast.m_SpellVelocity;
//		Debug.Log (m_MaximalVelocity);
    }
Esempio n. 9
0
        internal void UpdatePlayerClassFromSpell(SpellCast cast, SpellClass theClass)
        {
            if (!PlayerToClass.TryGetValue(cast.Caster, out SpellClassCounter counter))
            {
                lock (PlayerToClass)
                {
                    counter = new SpellClassCounter()
                    {
                        ClassCounts = new Dictionary <SpellClass, int>()
                    };
                    PlayerToClass.TryAdd(cast.Caster, counter);
                }
            }

            lock (counter)
            {
                int newValue = 1;
                if (counter.ClassCounts.TryGetValue(theClass, out int value))
                {
                    newValue += value;
                }

                counter.ClassCounts[theClass] = newValue;

                if (newValue > counter.CurrentMax)
                {
                    counter.CurrentMax   = value;
                    counter.CurrentClass = theClass;
                }
            }
        }
Esempio n. 10
0
    void Start()
    {
        SpellClass spell_class_instance = new SpellClass();

                #if START_WITH_FIREBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Fireball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_ICEBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Iceball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_SHIELD
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Shield));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_THUNDERBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Thunderball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_THUNDERSTORM
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Thunderstorm));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_HEAL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Heal));
        this.AssignDefaultActiveSpell();
        #endif
        #if START_WITH_TORNADO
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Tornado));
        this.AssignDefaultActiveSpell();
        #endif
        #if START_WITH_WATERBUBBLE
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.WaterBubble));
        this.AssignDefaultActiveSpell();
        #endif


        #if START_WITH_HEALTH_POTION
        ItemClass health_potion = new ItemClass();
        health_potion.GenerateInstance(ItemName.Health_Potion);
        this.AddItem(health_potion);
                #endif
                #if START_WITH_MANA_POTION
        ItemClass mana_potion = new ItemClass();
        mana_potion.GenerateInstance(ItemName.Mana_Potion);
        this.AddItem(mana_potion);
                #endif

        //In case we're loading in the scene
        if (this.m_ActiveSpellClass != null)
        {
            this.m_ActiveSpellIcon.UpdateActiveSpellSprite(this.m_ActiveSpellClass.m_SpellName);
        }
        else
        {
            this.m_ActiveSpellIcon.gameObject.transform.parent.gameObject.SetActive(false);
        }
    }    //end f'n void Start()
Esempio n. 11
0
    }         //end f'n void UpdateActiveSpell()

    /**A function to assign the default active SpellClass instance of the player.
     * Assumes the size of the spell class list is equal to 1.*/
    private void AssignDefaultActiveSpell()
    {
        this.m_ActiveSpellClass = this.m_SpellClassList [0];
        this.m_ActiveSpellName  = this.m_ActiveSpellClass.m_SpellName.ToString();

        this.GetComponent <PlayerCastSpell> ().m_SpellClassToFire = this.m_ActiveSpellClass;
//		Debug.Log ("Spell to fire " + this.GetComponent<PlayerCastSpell> ().m_SpellClassToFire.m_SpellName.ToString ());
    }    //end f'n void AssignDefaultActiveSpell()
Esempio n. 12
0
    void DeleteSpell(GameObject spell)
    {
        SpellClass spellcheck = spell.GetComponent <SpellClass>();

        if (spellcheck.nextSpell)
        {
            DeleteSpell(spellcheck.nextSpell);
        }
        Destroy(spell);
    }
Esempio n. 13
0
        internal SpellClass GetPlayerClassEnum(string name)
        {
            SpellClass spellClass = 0;

            if (!string.IsNullOrEmpty(name) && PlayerToClass.TryGetValue(name, out SpellClassCounter counter))
            {
                spellClass = counter.CurrentClass;
            }

            return(spellClass);
        }
Esempio n. 14
0
    /**A function to set the Item instance to this ItemPickup.*/
    public void SetSpell(SpellClass spell_spawned)
    {
        this.m_Spell.m_SpellName   = spell_spawned.m_SpellName;
        this.m_Spell.m_SpellEffect = spell_spawned.m_SpellEffect;
//		this.m_Spell.m_IsAOESpell = spell_spawned.m_IsAOESpell;
//		this.m_Spell.m_IsMobileSpell = spell_spawned.m_IsMobileSpell;
        this.m_Spell.m_IsPersistent = spell_spawned.m_IsPersistent;
        this.m_SpellName            = spell_spawned.m_SpellName.ToString();

//		Debug.Log ("Set spell: " + this.m_Spell.ReturnSpellInstanceInfo ());
    }    //end f'n void SetItem(Item)
Esempio n. 15
0
        private void SetTool(int Id)
        {
            for (int i = 0; i < 14; i++)
            {
                TextBlock tb = new TextBlock();

                tb.Text          = SpellClass.JustFindFileTool((string)Ch[i].Content, Id);
                tb.TextAlignment = TextAlignment.Center;

                Ch[i].ToolTip = tb;
            }
        }
Esempio n. 16
0
    }//end f'n void AffectHealth(float)

    /**Function which applies the effect of a spell on the enemy.
     * Should make it abstract when we add a variety of enemies.*/
    public void ApplySpellEffects(SpellName spell_name)
    {
        this.m_SpellHittingEnemy = new SpellClass();
        switch ((int)spell_name)
        {
        case (int)SpellName.Fireball:
        {
            this.AffectHealth(-10.0f);

            this.m_SpellHittingEnemy = this.m_SpellHittingEnemy.GenerateInstance(SpellName.Fireball);
            break;
        }                //end case Fireball

        case (int)SpellName.Iceball:
        {
            this.AffectHealth(-2.0f);

            this.m_SpellHittingEnemy = this.m_SpellHittingEnemy.GenerateInstance(SpellName.Iceball);
            break;
        }    //end case Iceball

        case (int)SpellName.Thunderball:
        {
            this.AffectHealth(-5.0f);
            this.m_ShockTimerIncrementor = 1;

            this.m_SpellHittingEnemy = this.m_SpellHittingEnemy.GenerateInstance(SpellName.Thunderball);
            break;
        }                //end case Thunderball

        case (int)SpellName.Thunderstorm:
        {
            this.AffectHealth(-40.0f);
            if (this.m_ShockTimerIncrementor > 10)
            {
                this.m_ShockTimerIncrementor = 1;
            }

            //No point making a section for thunderstorm; thunderball can be used for the same purpose.
            //We'll make an instance of thunderstorm but let the switch fall through to thunderball
            this.m_SpellHittingEnemy = this.m_SpellHittingEnemy.GenerateInstance(SpellName.Thunderstorm);
            break;
        }

        default:
        {
            //Impossible, right now
            break;
        }
        } //end switch
        this.m_SpellName = this.m_SpellHittingEnemy.m_SpellName;
    }     //end f'n void ApplySpellEffects(SpellName)
Esempio n. 17
0
 private void DontHaveEnoughStamina(SpellClass spell)
 {
     foreach (Transform ChosenCard in ButtonsCanvas.transform.GetChild(0))
     {
         if (ChosenCard.gameObject.name == spell.getNameSpell() && spell.getNameSpell() != "MagicRenewal")
         {
             float sum = playerManager.getTotalStaminaPlayer() - spell.getStaminaSpell();
             if (sum < 0)
             {
                 ChosenCard.gameObject.GetComponent <Button>().interactable = false;
             }
         }
     }
 }
Esempio n. 18
0
    /**A function to be called by whoever intends to use this spell manager to damage an [enemy].
     * We set the spell to apply and initialize its variables (duration and [isContinuous]) with respect to the spell name.*/
    public void SetSpellToApply(SpellClass spell_to_apply, Enemy enemy)
    {
        this.m_SpellToApply = spell_to_apply;
        this.m_Enemy        = enemy;

        switch ((int)this.m_SpellToApply.m_SpellName)
        {
        case (int)SpellName.Fireball:
        {
            //Fireball is instantaneous, and is not continuous
            this.m_SpellDuration = 0.0f;
            this.m_IsContinuous  = false;

            break;
        }                //end case fireball

        case (int)SpellName.Iceball:
        {
            //Iceball has a lasting effect on the enemy, but is not continuous
            this.m_SpellDuration = TIME_BEFORE_THAW;
            this.m_IsContinuous  = false;

            break;
        }                //end case iceball

        case (int)SpellName.Thunderball:
        {
            //Thunderball has a lasting effect on the enemy, but is not continuous
            this.m_SpellDuration = TIME_BEFORE_SHOCK_RELEASE;
            this.m_IsContinuous  = false;

            break;
        }                //end case Thunderball

        case (int)SpellName.Thunderstorm:
        {
            //Thunderstorm has a lasting effect on the enemy, and is continuous
            this.m_SpellDuration = TIME_BEFORE_SHOCK_RELEASE;
            this.m_IsContinuous  = true;

            break;
        }                //end case Thunderstorm

        default:
        {
            //impossible
            break;
        } //end case default
        } //end switch
    }     //end f'n void SetSpellToApply(SpellClass, Enemy)
Esempio n. 19
0
        internal static int HowManySpellsPlayerCanLearn(SpellClass spellClass, int spellLevel) //sub_4428E
        {
            int alreadyLearning = 0;

            foreach (int spellId in gbl.SelectedPlayer.spellList.IdList())
            {
                if (gbl.spellCastingTable[spellId].spellLevel == spellLevel &&
                    gbl.spellCastingTable[spellId].spellClass == spellClass)
                {
                    alreadyLearning++;
                }
            }

            return(gbl.SelectedPlayer.spellCastCount[(int)spellClass, spellLevel - 1] - alreadyLearning);
        }
Esempio n. 20
0
    }    //end f'n void Update

    private void UpdateCanCastSpell()
    {
        SpellClass active_spell = this.GetComponent <PlayerInventory> ().m_ActiveSpellClass;

        if (active_spell != null)
        {
            if (active_spell.m_IsPersistent)
            {
                this.m_CanCastSpells = (this.m_Mana >= active_spell.m_ManaCost * Time.deltaTime);
            }
            else
            {
                this.m_CanCastSpells = this.m_Mana >= active_spell.m_ManaCost;
            }
        }
    }
Esempio n. 21
0
    void PrintInfoOnText(Text t, Image tex, SpellClass s)
    {
        string castTime = s.SpellCastTime.ToString() + " seconds";
        if (Mathf.Approximately(s.SpellCastTime, 0.0f))
            castTime = "Instant";
        else if (Mathf.Approximately(s.SpellCastTime, 1.0f))
            castTime = s.SpellCastTime.ToString() + " second";

        string cooldown = s.SpellCooldown.ToString() + " seconds";

        if (Mathf.Approximately(s.SpellCooldown, 0.0f))
            cooldown = "None\n\n";
        else if (Mathf.Approximately(s.SpellCooldown, 1.0f))
            cooldown = s.SpellCooldown + " second\n\n";

        tex.sprite = icons.ReturnSpriteFromSpell(s.SpellEnum);
        t.text = s.SpellName + "\n\n" + s.SpellDescription + "\n\nCast Time: " + castTime + "\nCost: " + s.SpellCost + " mana\nCooldown: " + cooldown;
    }
Esempio n. 22
0
    public PlayerClass(int level, float hp, float stamina)
    {
        this.Level        = level;
        this.Hp           = hp;
        this.TotalStamina = stamina;
        this.Stamina      = stamina;
        this.TotalHp      = hp;
        this.StaminaBonus = 14 + Level;


        NamesArray[0]  = "SnowFlakesAttack";
        NamesArray[1]  = "FogAttack";
        NamesArray[2]  = "WaterFallAttack";
        NamesArray[3]  = "HailAttack";
        NamesArray[4]  = "IciclesAttack";
        NamesArray[5]  = "IceBallAttack";
        NamesArray[6]  = "IceFieldAttack";
        NamesArray[7]  = "WhirlpoolAttack";
        NamesArray[8]  = "AvalancheAttack";
        NamesArray[9]  = "TsunamiAttack";
        NamesArray[10] = "MagicRenewal";
        NamesArray[11] = "Shield";
        NamesArray[12] = "Heal";

        for (int i = 0; i < spellsArray.Length; i++)
        {
            if (i <= 9)
            {
                spellsArray[i] = new SpellClass(NamesArray[i], (num + i * 5), (num + i * 5));
            }
            if (i == 10)
            {
                spellsArray[i] = new SpellClass(NamesArray[i], -20f, 0f);                //change it that it will be dependent in the level
            }
            if (i == 12)
            {
                spellsArray[i] = new SpellClass(NamesArray[i], 20f, 20f);                //change it that it will be dependent in the level
            }
            if (i == 11)
            {
                spellsArray[i] = new SpellClass(NamesArray[i], 0f, 0f);                //change it that it will be dependent in the level
            }
        }
    }
Esempio n. 23
0
        internal void UpdatePlayerClassFromSpell(SpellCast cast, SpellClass theClass, double currentTime)
        {
            if (!PlayerToClass.TryGetValue(cast.Caster, out SpellClassCounter counter))
            {
                lock (PlayerToClass)
                {
                    counter = new SpellClassCounter {
                        ClassCounts = new Dictionary <SpellClass, long>()
                    };
                    PlayerToClass.TryAdd(cast.Caster, counter);
                }
            }

            lock (counter)
            {
                long newValue = 1;
                if (cast.SpellData.Rank > 1)
                {
                    newValue = 10;
                    AddVerifiedPlayer(cast.Caster, currentTime);
                }

                if (counter.ClassCounts.TryGetValue(theClass, out long value))
                {
                    newValue += value;
                }

                counter.ClassCounts[theClass] = newValue;

                if (newValue > counter.CurrentMax)
                {
                    counter.CurrentMax = newValue;
                    if (!theClass.Equals(counter.CurrentClass))
                    {
                        if (LOG.IsDebugEnabled)
                        {
                            LOG.Debug("Assigning " + cast.Caster + " as " + theClass.ToString() + " from " + cast.Spell);
                        }
                    }
                    counter.CurrentClass = theClass;
                }
            }
        }
Esempio n. 24
0
    public static void InitiateGame()
    {
        if (GameInitiated)
            return;

        PartyStats.Initiate();
        SpellStats.Initiate();
        Achievements.Initiate();
        PlayerStats.Initiate();
        SpellStats.ApplyTalentsToSpells();
        PartyStats.ApplyTalentsToPartyMembers();

        CurrentBossFight = BossFightEnum.BossFight01;

        Spell1 = SpellStats.GetSpellClass(Spell.Spell1);
        Spell2 = SpellStats.GetSpellClass(Spell.Spell3);
        Spell3 = SpellStats.GetSpellClass(Spell.Spell2);
        Spell4 = SpellStats.GetSpellClass(Spell.Spell6);
        UltimateSpell = SpellStats.GetSpellClass(Spell.Ultimate4);

        SpellList.Add(Spell1);
        SpellList.Add(Spell2);
        SpellList.Add(Spell3);
        SpellList.Add(Spell4);
        SpellList.Add(UltimateSpell);

        Tank = PartyStats.GetPartyMemberFromEnum(PartyMember.Tank1);
        DPS1 = PartyStats.GetPartyMemberFromEnum(PartyMember.DPS1);
        DPS2 = PartyStats.GetPartyMemberFromEnum(PartyMember.DPS2);
        DPS3 = PartyStats.GetPartyMemberFromEnum(PartyMember.DPS3);
        Healer = PartyStats.GetPartyMemberFromEnum(PartyMember.Healer);

        CurrentParty.Add(Tank);
        CurrentParty.Add(DPS1);
        CurrentParty.Add(DPS2);
        CurrentParty.Add(DPS3);
        CurrentParty.Add(Healer);

        GameInitiated = true;
    }
Esempio n. 25
0
    public enemyManager(float hp, float stamina, bool isBoss)
    {
        this.Hp           = hp;
        this.TotalStamina = stamina;
        this.Stamina      = stamina;
        this.TotalHp      = hp;
        this.StaminaBonus = 14 + Level;
        this.isBoss       = isBoss;

        movesArray[0] = "downEnemy";
        movesArray[1] = "upEnemy";
        movesArray[2] = "rightEnemy";
        movesArray[3] = "leftEnemy";
        movesArray[4] = "ShieldEnemy";
        movesArray[5] = "MagicRenewalEnemy";
        movesArray[6] = "RockPunchAttack";
        movesArray[7] = "RollingStoneAttack";

        attacks = new SpellClass[3];

        if (isBoss == false)
        {
            attacks[1] = new SpellClass("RockPunchAttack", 20f, 20f);
            attacks[0] = new SpellClass("RollingStoneAttack", 15f, 15f);
        }

        if (isBoss == true)
        {
            attacks[1]         = new SpellClass("RockPunchAttack", 20f, 30f);
            attacks[0]         = new SpellClass("RollingStoneAttack", 15f, 25f);
            this.Hp           += 15;
            this.TotalStamina += 15;
            this.Stamina      += 15;
            this.TotalHp      += 15;
        }
        attacks[2] = new SpellClass("MagicRenewalEnemy", -20f, 0f);

        ResetEnemy();
    }
Esempio n. 26
0
        internal bool CheckForSpellAmbiguity(SpellData spellData, SpellClass spellClass, out SpellData replaced)
        {
            replaced = null;

            if (spellData.Target == 6 && spellData.Level != 255 && spellClass != 0 && (spellData.ClassMask & (int)spellClass) == 0)
            {
                List <SpellData> list;
                if (GetNonPosessiveLandsOnOther(spellData.LandsOnOther, out list) != null)
                {
                    replaced = list.FirstOrDefault(data => (data.ClassMask & (int)spellClass) != 0);
                }
                else if (GetPosessiveLandsOnOther(spellData.LandsOnOther, out list) != null)
                {
                    replaced = list.FirstOrDefault(data => (data.ClassMask & (int)spellClass) != 0);
                }
                else if (GetLandsOnYou(spellData.LandsOnYou, out list) != null)
                {
                    replaced = list.FirstOrDefault(data => (data.ClassMask & (int)spellClass) != 0);
                }
            }

            return(replaced != null);
        }
Esempio n. 27
0
    }    //end f'n void AddItem(Item)

    /**A function to add a SpellClass object to the SpellClass list if the SpellClass is not already in the list.*/
    public void AddSpell(SpellClass spell_to_add)
    {
                #if TESTING_INVENTORY_SPELLPICKUP
        string message = "";
        message += "PlayerInventory::Adding spell " + spell_to_add.m_SpellName.ToString() + "\t";
                #endif
        foreach (SpellClass spell in this.m_SpellClassList)
        {
            if (spell.m_SpellName.ToString() == spell_to_add.m_SpellName.ToString())
            {
                                #if TESTING_INVENTORY_SPELLPICKUP
                message += "spell " + spell_to_add.m_SpellName.ToString() + " already found in inventory; making no changes";
                Debug.Log(message);
                                #endif
                return;
            }
        }
                #if TESTING_INVENTORY_SPELLPICKUP
        message += "spell " + spell_to_add.m_SpellName.ToString() + " not already found in inventory; adding...";
        Debug.Log(message);
                #endif
        this.m_SpellClassList.Add(spell_to_add);
    }    //end f'n void AddSpell(SpellClass)
Esempio n. 28
0
    }     //end f'n void ParseSpellList(List<SpellClass>)

    /**A function to fill the player spell list according to the save.
     * Clears player spell list before adding anything.*/
    public void SetSpellList(GameObject player)
    {
        PlayerInventory player_inventory = player.GetComponent <PlayerInventory> ();

        player_inventory.m_SpellClassList.Clear();

        for (int index = 0; index < this.m_SpellNames.Count; index++)
        {
            SpellClass spell_to_add = new SpellClass();

            //for every spell name...
            foreach (SpellName name in System.Enum.GetValues(typeof(SpellName)))
            {
                //...if the name in the enum matches that of the list...
                if (this.m_SpellNames [index] == name.ToString())
                {
                    //...then create the item from the enum value and add it to the spell list
                    spell_to_add = spell_to_add.GenerateInstance(name);
                    player_inventory.AddSpell(spell_to_add);
                } //end if
            }     //end foreach
        }         //end foreach
    }             //end f'n void SetSpellList(GameObject player)
Esempio n. 29
0
    }     //end f'n void ApplySpellEffects(SpellName)

    /**A function to inflict the enemy with an extra effect (beyond losing health)*/
    private void ExecuteExtraInfliction()
    {
        /*
         * There's three phases to a spell with a duration greater than 0;
         * 1. the start of the timer
         * 2. the time where the timer has started but hasn't finished
         * 3. the end of the timer
         */
        switch ((int)this.m_SpellHittingEnemy.m_SpellName)
        {
        case (int)SpellName.Fireball:
        {
            //do nothing
            break;
        }

        case (int)SpellName.Iceball:
        {
            //Freeze the enemy for Iceball.duration and then let them go

            //Phase 1
            if (this.m_ExtraEffectTimer == 0.0f)
            {
                //...stop the enemy from moving
                this.m_CanMove = false;
                //...and stop the animator
                this.gameObject.GetComponent <Animator> ().enabled = false;
                this.m_ExtraEffectTimer += Time.deltaTime;
            }
            //Phase 2
            else if (0.0f < this.m_ExtraEffectTimer && this.m_ExtraEffectTimer < this.m_SpellHittingEnemy.m_EffectDuration)
            {
                //Increment timer
                this.m_ExtraEffectTimer += Time.deltaTime;
            }
            //Phase 3
            //if the spell effect duration <= the spell effect timer
            else
            {
                //Unfreeze the enemy
                this.m_CanMove = true;
                this.gameObject.GetComponent <Animator> ().enabled = true;

                //Reset the effect timer
                this.m_ExtraEffectTimer = 0.0f;
                //Reset the spell we were hit with
                this.m_SpellHittingEnemy = null;
            }                    //end else

            break;
        }                //end case Iceball

        //Let thunderstorm case fall to thunderball
        case (int)SpellName.Thunderstorm:
        case (int)SpellName.Thunderball:
        {
            //Shock the enemy for Thunderball.duration and let them go

            //Phase 1
            if (this.m_ExtraEffectTimer == 0.0f)
            {
                //Stop the enemy moving
                //...stop the enemy from moving
                this.m_CanMove = false;
                //...and stop the animator
                this.gameObject.GetComponent <Animator> ().enabled = false;
                this.m_ExtraEffectTimer += Time.deltaTime;
            }
            //Phase 2
            else if (0.0f < this.m_ExtraEffectTimer && this.m_ExtraEffectTimer < this.m_SpellHittingEnemy.m_EffectDuration)
            {
                //if the shock timer is greater-than or equal to the shock incrementor * shock jump frequency...
                if (this.m_ExtraEffectTimer >= this.m_ShockTimerIncrementor * this.m_ShockJumpFrequency)
                {
                    //...then move the enemy either up or down

                    Vector3 position = this.transform.position;
                    //...where if the shock timer incrementor is odd, we move the enemy up
                    //...and if the shock timer incrementor is even, we move the enemy back down
                    position.y += (this.m_ShockTimerIncrementor % 2 == 1) ? this.m_ShockJumpDistance : -(this.m_ShockJumpDistance);
                    this.transform.position = position;

                    this.m_ShockTimerIncrementor++;
                }
                this.m_ExtraEffectTimer += Time.deltaTime;
            }
            //Phase 3
            //if the spell effect duration <= the spell effect timer
            else
            {
                //...then release the enemy
                this.gameObject.GetComponent <Animator> ().enabled = true;
                this.m_CanMove = true;
                //...ensure the enemy is at the proper height
                Vector3 position = this.transform.position;
                position.y = this.m_EnemyStartHeight;
                this.transform.position = position;

                //Reset the shock timer incrementor
                this.m_ShockTimerIncrementor = 1;
                //Reset the effect timer
                this.m_ExtraEffectTimer = 0.0f;
                //Reset the spell we were hit with
                this.m_SpellHittingEnemy = null;
            }                    //end if

            break;
        } //end case thunderball
        } //end switch
    }     //end f'n void ExecuteExtraInfliction()
Esempio n. 30
0
    public static void SetNewSpellFromIndex(int i, Spell spell)
    {
        SpellList.RemoveAt(i);
        SpellList.Add(SpellStats.GetSpellClass(spell));

        if (Spell1.SpellEnum == CurrentSpellBeingChanged.SpellEnum)
        {
            Spell1 = SpellStats.GetSpellClass(spell);
        }
        else if (Spell2.SpellEnum == CurrentSpellBeingChanged.SpellEnum)
        {
            Spell2 = SpellStats.GetSpellClass(spell);
        }
        else if (Spell3.SpellEnum == CurrentSpellBeingChanged.SpellEnum)
        {
            Spell3 = SpellStats.GetSpellClass(spell);
        }
        else if (Spell4.SpellEnum == CurrentSpellBeingChanged.SpellEnum)
        {
            Spell4 = SpellStats.GetSpellClass(spell);
        }
        else if (UltimateSpell.SpellEnum == CurrentSpellBeingChanged.SpellEnum)
        {
            UltimateSpell = SpellStats.GetSpellClass(spell);
        }
    }
Esempio n. 31
0
        public SpellWhen whenCast; //seg600:37E7 unk_19AF7

        #endregion Fields

        #region Constructors

        public SpellEntry(int spell_idx, SpellClass _spellClass, sbyte _spellLevel,
            int _fixedRange, int _perLvlRange,
            int _fixedDuration, byte _perLvlDuration,
            byte f6, SpellTargets _targets,
            DamageOnSave _damageOnSave, SaveVerseType _saveVerse,
            Affects _affectId, SpellWhen _whenCast,
            int _castingDelay, int _priority, byte fe, byte ff)
        {
            spellClass = _spellClass;
            spellLevel = _spellLevel;
            fixedRange = _fixedRange;
            perLvlRange = _perLvlRange;
            fixedDuration = _fixedDuration;
            perLvlDuration = _perLvlDuration;
            field_6 = f6;
            targetType = _targets;
            damageOnSave = _damageOnSave;
            saveVerse = _saveVerse;
            affect_id = _affectId;
            whenCast = _whenCast;
            castingDelay = _castingDelay;
            priority = _priority;
            field_E = fe;
            field_F = ff;
            spellIdx = spell_idx;
        }
Esempio n. 32
0
 public Spell(string name, SpellClass c, SpellLevel l)
 {
     sName = name;
     sClass = c;
     sLevel = l;
 }
Esempio n. 33
0
    }    //end f'n void Update()

    /**A function to update the player's active SpellClass instance with respect to mousewheel input.
     * Switches to next rightward spell if the input is forward; switches to next leftward spell if the input is backward.*/
    private void UpdateActiveSpell()
    {
        //the user needs to have at least two spells to be able to switch between them
        if (this.m_SpellClassList.Count > 1)
        {
            float input = Input.GetAxis(STRINGKEY_INPUT_SWITCHSPELLS);

            //If the user wants to switch their active spells...
            if (input != 0)
            {
                int next_index            = 0;
                int index_of_active_spell = this.m_SpellClassList.IndexOf(this.m_ActiveSpellClass);
                //if the user scrolls forward...
                if (input > 0.0f)
                {
                    //...then switch to the next rightward spell

                    //if the index of the active spell is equal to that of the last spell in the list...
                    if (index_of_active_spell == this.m_SpellClassList.Count - 1)
                    {
                        //...then the next rightward spell is the first one.
                        next_index = 0;
                    }                    //end if
                    //else if the index of the active spell is not the last spell in the list...
                    else
                    {
                        //...then the next index is simply one further on.
                        next_index = index_of_active_spell + 1;
                    }            //end else
                }                //end if
                //else if the user scrolls backward...
                else             //if input < 0.0f
                                 //...then switch to the next leftward spell

                //if the index of the active spell is equal to that of the first spell in the list...
                {
                    if (index_of_active_spell == 0)
                    {
                        //...then the next leftward spell is the last one.
                        next_index = this.m_SpellClassList.Count - 1;
                    }                    //end if
                    //else if the index of the active spell is not that of the first spell in the list...
                    else
                    {
                        //...then the next index is simply one preceding the one we're at.
                        next_index = index_of_active_spell - 1;
                    }            //end else
                }                //end else

                //Update active spell
                this.m_ActiveSpellClass = this.m_SpellClassList [next_index];
                this.m_ActiveSpellName  = this.m_ActiveSpellClass.m_SpellName.ToString();

                //Update active spell icon
                this.m_ActiveSpellIcon.UpdateActiveSpellSprite(this.m_ActiveSpellClass.m_SpellName);

                this.GetComponent <PlayerCastSpell> ().m_SpellClassToFire = this.m_ActiveSpellClass;

                                #if TESTING_ACTIVE_SPELL
                Debug.Log("UpdateActiveSpell::Active SpellClass: " + this.m_ActiveSpellClass.m_SpellName.ToString());
                                #endif
            } //end if
        }     //end if
    }         //end f'n void UpdateActiveSpell()
Esempio n. 34
0
 public override void ApplySpellEffect(SpellClass spell)
 {
     base.ApplySpellEffect(spell);
 }
Esempio n. 35
0
        //sub_4428E
        internal static int HowManySpellsPlayerCanLearn(SpellClass spellClass, int spellLevel)
        {
            int alreadyLearning = 0;

            foreach (int spellId in gbl.SelectedPlayer.spellList.IdList())
            {
                if (gbl.spellCastingTable[spellId].spellLevel == spellLevel &&
                    gbl.spellCastingTable[spellId].spellClass == spellClass)
                {
                    alreadyLearning++;
                }
            }

            return gbl.SelectedPlayer.spellCastCount[(int)spellClass, spellLevel - 1] - alreadyLearning;
        }
Esempio n. 36
0
 internal string GetClassName(SpellClass spellClass)
 {
     ClassNames.TryGetValue(spellClass, out string name);
     return(name);
 }