Ejemplo n.º 1
0
    //deploy the spell or start a cell selection procedure if needed
    public void prepareSpell(SpellID spellid)
    {
        if (!players [turnmanager.currentplayer - 1].isSpellReadyForUse(spellid))
        {
            Debug.Log("Spell under cooldown");
            return;
        }

        //prepareSpell the Spell int the Spell deployer
        spelldeployer.prepareSpell(spellid);

        //set effected dragons if all is range of effect
        if (spelldeployer.doesSpellEffectsAllDragons())
        {
            if (spelldeployer.isSpellSelfEffecting())
            {
                utility_listofdragons = battlefieldgamedata.getAllDragonOfPlayer((uint)(turnmanager.currentplayer - 1));
            }
            else
            {
                utility_listofdragons = battlefieldgamedata.getAllDragonNotOfPlayer((uint)(turnmanager.currentplayer - 1));
            }
        }

        //selected dragon spell(Start selection procedure)
        else
        {
            setState(GameStates.SPELL_DRAGONSELECT);
            //not needed     utility_spellid = spellid;
            utility_listofdragons = new List <Dragon> ();
        }
    }
Ejemplo n.º 2
0
 public void onSpellEnd(SpellID sid)
 {
     if (m_spellID == sid)
     {
         spellEnd();
     }
 }
Ejemplo n.º 3
0
    //Spells

    /* static void AutoSelectSpellIfNull()
     * {
     *   if (currentSpell == null)
     *   {
     *       BackgroundSelectApplicableSpell();
     *   }
     * }*/

    public static void SetCurrentSpell(SpellID spellID)
    {
        Spell spell = Spell.Definitions[spellID];

        currentSpell = spell;
        LayoutManager.Main.UpdateAll();
    }
Ejemplo n.º 4
0
 public void onSpellStart(SpellID sid)
 {
     if (m_spellID == sid)
     {
         spellStart();
     }
 }
Ejemplo n.º 5
0
    public void Restock()
    {
        foreach (KeyValuePair <IngredientID, Listing> entry in Wares)
        {
            entry.Value.quantity = entry.Value.maxQuantity;
        }


        //Restock Scrolls
        Scrolls.Clear();

        var query = from spellID in Spell.RandomSpells.KeyList()
                    where Engine.Hero == null || !Engine.Hero.SpellsKnown.Contains(spellID)
                    where Spell.Definitions[spellID].skill <= (Engine.Hero == null ? 1 : Engine.Hero.Level)
                    select spellID;
        List <SpellID> validSpellIDs = new List <SpellID>(query);

        validSpellIDs.Shuffle();


        while (Scrolls.Count < idealScrollCount && validSpellIDs.Count > 0)
        {
            SpellID spellID = validSpellIDs.First();
            Scrolls.Add(spellID, new Listing(Spell.Definitions[spellID].scrollCost, 1));
            validSpellIDs.Remove(spellID);
        }
    }
Ejemplo n.º 6
0
 void learnScroll(SpellID spell)
 {
     if (Scrolls.Contains(spell))
     {
         Scrolls.Remove(spell);
         SpellsKnown.Add(spell);
     }
 }
Ejemplo n.º 7
0
 //the +1 is because the current turn is also counted (update of cooldown is very last of updates)
 public void setCoolDown(SpellID spellid, uint cooldown)
 {
     foreach (PlayersSpell pspell in playerspells)
     {
         if (pspell.spellid == spellid)
         {
             pspell.turnsuntilavailable = cooldown + 1;
         }
     }
 }
Ejemplo n.º 8
0
 public Spell(SpellID spellID, SpellEntry spellEntry)
 {
     SpellID = spellID;
     //TODO Fix SpellEntry Name.
     Name             = "";
     Cooldown         = spellEntry.RecoveryTime;
     CooldownCatagory = spellEntry.CategoryRecoveryTime;
     Catagory         = spellEntry.Category;
     Range            = spellEntry.rangeIndex > 0 ? spellEntry.rangeIndex : 30;
     IsPassive        = spellEntry.Attributes.HasFlag(SpellAttributes.SPELL_ATTR_PASSIVE);
 }
Ejemplo n.º 9
0
 public Spell(SpellID spellID, SpellEntry spellEntry)
 {
     SpellID = spellID;
     //TODO Fix SpellEntry Name.
     Name = "";
     Cooldown = spellEntry.RecoveryTime;
     CooldownCatagory = spellEntry.CategoryRecoveryTime;
     Catagory = spellEntry.Category;
     Range = spellEntry.rangeIndex > 0 ? spellEntry.rangeIndex : 30;
     IsPassive = spellEntry.Attributes.HasFlag(SpellAttributes.SPELL_ATTR_PASSIVE);
 }
Ejemplo n.º 10
0
 public bool isSpellReadyForUse(SpellID spellid)
 {
     foreach (PlayersSpell pspell in playerspells)
     {
         if (pspell.spellid == spellid)
         {
             return(pspell.turnsuntilavailable == 0u);
         }
     }
     return(false);
 }
Ejemplo n.º 11
0
    public void deploySpell(SpellID spellid)
    {
        uint cooldown = spelldeployer.getCoolDown();

        //deploy the spell with the list of dragons in utility list of dragos
        spelldeployer.deploySpell(utility_listofdragons);

        //set spell cooldown in the playerdata
        players[turnmanager.currentplayer - 1].setCoolDown(spellid, cooldown);

        //set the utility list to null (just for safety and garbage collection)
        utility_listofdragons = null;
    }
Ejemplo n.º 12
0
    public void prepareSpell(SpellID spellid)
    {
        Debug.Log(spellid);
        switch (spellid)
        {
        case SpellID.POISIONBOMB:
            currentspell = new Spell2();
            break;

        case SpellID.POISIONARRAOW:
            currentspell = new Spell1();
            break;
        }
    }
Ejemplo n.º 13
0
    //

    public Spell(string name, SpellID id, int castTime, DomainID domain)
    {
        this.name           = name;
        this.id             = id;
        this.castTime       = castTime;
        this.domain         = domain;
        skill               = castTime;
        scrollCost          = scrollCosts[skill - 1] + Random.Range(-2, 3);
        IngredientCost      = new Dictionary <IngredientID, int>();
        ArtifactsRequired   = new List <ArtifactID>();
        EffectsProduced     = new List <SpellEffect>();
        requiresValidTarget = true;
        sprite              = Util.RandomElement(LayoutManager.Main.SpellIcons);
        Definitions.Add(id, this);
        CastRewards = new Reward();
    }
Ejemplo n.º 14
0
    public static void BuyScrollFromCurrentMarket(SpellID spell)
    {
        Hero.GainSpell(spell);
        Hero.Aurum -= currentMarket.Scrolls[spell].cost;
        currentMarket.Scrolls[spell].quantity--;

        if (currentMarket.Scrolls[spell].quantity <= 0)
        {
            currentMarket.Scrolls.Remove(spell);
        }

        //if the purchased spell fufils the current job, select it
        BackgroundSelectApplicableSpell();

        LayoutManager.Main.UpdateAll();
    }
Ejemplo n.º 15
0
        private void filter_Click(object sender, EventArgs e)
        {
            if (!int.TryParse(SpellID.Text, out _spellID))
            {
                MessageBox.Show("Veuillez entrez une valeur numérique supérieur ou égale à 0 pour le champ SpellID");
                SpellID.Focus();
                return;
            }

            if (!int.TryParse(Level.Text, out _level))
            {
                MessageBox.Show("Veuillez entrez une valeur numérique supérieur ou égale à 0 pour le champ Level");
                Level.Focus();
                return;
            }

            mysql.spells spell = (DataBase.DataTables.spells as List <mysql.spells>).Find(f => f.spellID == _spellID && f.level == _level);

            if (spell.target != null)
            {
                string[] filter = spell.target.Split('#');
                spellTargetCB.Items.AddRange(filter);

                targetList.Items.AddRange("self#enemy_1#ally_1#none#ally_summon#enemy_summon#ally_all#enemy_all".Split('#'));
                foreach (string s in spellTargetCB.Items)
                {
                    targetList.Items.Remove(s);
                }

                if (spellTargetCB.Items.Count > 0)
                {
                    spellTargetCB.SelectedIndex = 0;
                }

                if (targetList.Items.Count > 0)
                {
                    targetList.SelectedIndex = 0;
                }
            }
            else
            {
                MessageBox.Show("No target found for this spell");
                targetList.Items.AddRange("self#enemy_1#ally_1#none#ally_summon#enemy_summon#ally_all#enemy_all".Split('#'));
            }
        }
Ejemplo n.º 16
0
    private void activateSpell(SpellID spellid)
    {
        if (!mastergamerunner.isSpellUsable(spellid))
        {
            Debug.Log("Spell not usable");
            return;
        }

        //disable spell buttons
        spellbuttongroup.SetActive(false);

        //activate deploy spell button
        deployspellbutton.gameObject.SetActive(true);

        //just prepare the spell not deploy it
        mastergamerunner.prepareSpell(spellid);
        utility_spellid = spellid;
    }
Ejemplo n.º 17
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                hashCode += 1000000007 * Type.GetHashCode();
                hashCode += 1000000009 * Class.GetHashCode();
                hashCode += 1000000021 * Slot.GetHashCode();
                hashCode += 1000000033 * BreakRate.GetHashCode();
                hashCode += 1000000087 * Gender.GetHashCode();
                hashCode += 1000000093 * FreeHands.GetHashCode();
                hashCode += 1000000097 * LifePointsBonus.GetHashCode();
                hashCode += 1000000103 * SpellPointsBonus.GetHashCode();
                hashCode += 1000000123 * AttributeType.GetHashCode();
                hashCode += 1000000181 * AttributeBonus.GetHashCode();
                hashCode += 1000000207 * SkillTypeBonus.GetHashCode();
                hashCode += 1000000223 * SkillBonus.GetHashCode();
                hashCode += 1000000241 * PhysicalDamageProtection.GetHashCode();
                hashCode += 1000000271 * PhysicalDamageCaused.GetHashCode();
                hashCode += 1000000289 * AmmunitionType.GetHashCode();
                hashCode += 1000000297 * SkillType1Tax.GetHashCode();
                hashCode += 1000000321 * SkillType2Tax.GetHashCode();
                hashCode += 1000000349 * Skill1Tax.GetHashCode();
                hashCode += 1000000363 * Skill2Tax.GetHashCode();
                hashCode += 1000000403 * TorchIntensity.GetHashCode();
                hashCode += 1000000409 * AmmoAnimation.GetHashCode();
                hashCode += 1000000411 * Spell.GetHashCode();
                hashCode += 1000000427 * SpellID.GetHashCode();
                hashCode += 1000000433 * Charges.GetHashCode();
                hashCode += 1000000439 * NumRecharged.GetHashCode();
                hashCode += 1000000447 * MaxNumRecharged.GetHashCode();
                hashCode += 1000000453 * MaxCharges.GetHashCode();
                hashCode += 1000000459 * Count1.GetHashCode();
                hashCode += 1000000483 * Count2.GetHashCode();
                hashCode += 1000000513 * IconAnim.GetHashCode();
                hashCode += 1000000531 * Weight.GetHashCode();
                hashCode += 1000000579 * Value.GetHashCode();
                hashCode += 1000000007 * Icon.GetHashCode();
                hashCode += 1000000009 * UsingClass.GetHashCode();
                hashCode += 1000000021 * UsingRace.GetHashCode();
            }
            return(hashCode);
        }
Ejemplo n.º 18
0
 public PlayersSpell(SpellID spellid)
 {
     this.spellid        = spellid;
     turnsuntilavailable = 0u;
 }
Ejemplo n.º 19
0
 //is spell ready to be used
 public bool isSpellUsable(SpellID spellid)
 {
     return(players [turnmanager.currentplayer - 1].isSpellReadyForUse(spellid));
 }
Ejemplo n.º 20
0
 public static bool CanBuySpellFromCurrentMarket(SpellID spell)
 {
     return(CanBuyFromListing(currentMarket.Scrolls[spell]));
 }
Ejemplo n.º 21
0
 public void Setup(SpellID spell)
 {
     mySpell         = spell;
     ButtonText.text = Spell.Definitions[spell].name;
     image.sprite    = Spell.Definitions[spell].sprite;
 }
Ejemplo n.º 22
0
 public void GainSpell(SpellID spell)
 {
     SpellsKnown.Add(spell);
 }