Example #1
0
    public HashSet <Tile> GetAvailableTargets(Tile tile)
    {
        HashSet <Tile> ret = new HashSet <Tile>(RangeAndMelee.StaticGetTiles(tile));

        ret.UnionWith(IncreasedRange.StaticGetTiles(tile));
        return(ret);
    }
Example #2
0
    public HashSet <Tile> GetAvailableTargets()
    {
        Tile           t   = GetComponent <Unit>().Tile;
        HashSet <Tile> ret = new HashSet <Tile>(RangeAndMelee.StaticGetTiles(t));

        ret.UnionWith(IncreasedRange.StaticGetTiles(t));
        return(ret);
    }
Example #3
0
    public System.Collections.Generic.HashSet <Tile> GetAvailableTargets(Tile tile)
    {
        Unit           host   = GetComponent <Unit>();
        HashSet <Tile> retVal = new HashSet <Tile>();

        foreach (Tile t in RangeAndMelee.StaticGetTiles(tile))
        {
            if (t.isOccuppied && host.isHostile(t.Unit) && !t.Unit.invisible)
            {
                retVal.Add(t);
            }
        }
        return(retVal);
    }
Example #4
0
    public HashSet <Tile> GetAvailableTargets(Tile tile)
    {
        Unit host = GetComponent <Unit>();

        HashSet <Tile> retVal = new HashSet <Tile>();

        if (host == null)
        {
            Debug.LogError("host not found, is the charm ability sitting on a unit?");
            return(retVal);
        }
        foreach (Tile t in RangeAndMelee.StaticGetTiles(tile))
        {
            if (t.isOccuppied && host.isHostile(t.Unit) && !t.Unit.invisible)
            {
                retVal.Add(t);
            }
        }
        return(retVal);
    }
Example #5
0
    /// <summary>
    /// Get the weapon you generated.
    /// </summary>
    /// <returns></returns>
    public Weapon GetWeapon()
    {
        Weapon w = new Weapon();

        w.Name = Name;
        w.buff = new Stats();

        float power         = level + 4;
        float advantages    = 0f;
        float disadvantages = 0f;

        // advantages
        if (reach == MELEEANDRANGE)
        {
            advantages += 0.25f;
        }
        if (reach == LONGRANGE)
        {
            advantages += 0.15f;
        }
        if (defences == APIERCE)
        {
            advantages += 0.5f;
        }
        if (hitMod > 0)
        {
            advantages += hitMod / 20f;
        }
        if (critMod > 0)
        {
            advantages += critMod / 20f;
        }

        // disadvantages
        if (hitMod < 0)
        {
            disadvantages += hitMod / 20f;
        }

        // modify base damage to work with modifiers
        power /= 1f + advantages;
        power *= 1f + disadvantages;

        // grant the weapon appropiate range
        IReach ir;

        if (reach == MELEE)
        {
            ir = new Melee();
        }
        else if (reach == MELEEANDRANGE)
        {
            ir = new RangeAndMelee();
        }
        else if (reach == LONGRANGE)
        {
            ir = new IncreasedRange();
        }
        else
        {
            ir = new Ranged();
        }

        // Weapon Damage Stuffs
        WeaponDamage wd = new WeaponDamage();

        wd.StrScale   = strenght * 0.25f;
        wd.DexScale   = dexterity * 0.25f;
        wd.IntScale   = intelligence * 0.25f;
        wd.BaseDamage = (int)power;

        w.attackInfo = new AttackInfo(ir, wd, null, anim);

        w.buff.hitBonus  += hitMod * 0.1f;
        w.buff.critBonus += critMod * 0.15f;

        level  += 4;
        w.value = level * level * 2;

        w.icon = SpriteLibrary.GetIcon("weapon");

        return(w);
    }