示例#1
0
    public static StatAttr GetBestFor(StatGen stats, StatRank rank)
    {
        List <Tuple <StatAttr, int> > t = new List <Tuple <StatAttr, int> >();

        t.Add(new Tuple <StatAttr, int>(StatAttr.STR, CalcForStat(stats, StatAttr.STR)));
        t.Add(new Tuple <StatAttr, int>(StatAttr.DEX, CalcForStat(stats, StatAttr.DEX)));
        t.Add(new Tuple <StatAttr, int>(StatAttr.CON, CalcForStat(stats, StatAttr.CON)));
        t.Add(new Tuple <StatAttr, int>(StatAttr.INT, CalcForStat(stats, StatAttr.INT)));
        t.Add(new Tuple <StatAttr, int>(StatAttr.WIS, CalcForStat(stats, StatAttr.WIS)));
        t.Add(new Tuple <StatAttr, int>(StatAttr.CHA, CalcForStat(stats, StatAttr.CHA)));

        t.Sort((x, y) => y.Item2.CompareTo(x.Item2));
        switch (rank)
        {
        case StatRank.KEY:
            return(t[0].Item1);

        case StatRank.SECONDARY:
            return(t[1].Item1);

        case StatRank.TERTIARY:
            return(t[2].Item1);

        case StatRank.NICE:
            return(t[2].Item1);

        case StatRank.DUMP:
            return(t[3].Item1);
        }
        return(t[0].Item1);
    }
示例#2
0
 public static StatAttr GetSecondaryStat(Character chr, StatRank rank)
 {
     switch (rank)
     {
     case StatRank.KEY:
         return(chr.classStat);
     }
     return(StatGen.GetBestFor(chr.statGen, rank, chr.classStat));
 }
示例#3
0
    public static int GetValue(StatRank rank, int lvl)
    {
        //TODO: items by level
        if (lvl < 5)
        {
            switch (rank)
            {
            case StatRank.DUMP:
                return(0);

            case StatRank.NICE:
                return(1);

            case StatRank.TERTIARY:
                return(1);

            case StatRank.SECONDARY:
                return(3);

            case StatRank.KEY:
                return(4);
            }
        }
        int boosts = lvl / 5;

        switch (rank)
        {
        case StatRank.DUMP:
            return(0);

        case StatRank.NICE:
            return(1 + (boosts / 2));

        case StatRank.TERTIARY:
            return(1 + boosts);

        case StatRank.SECONDARY:
            return(4 + ((boosts - 1) / 2));

        case StatRank.KEY:
            return(4 + (boosts / 2));
        }
        return(0);
    }
示例#4
0
    private static StatAttr GetBestSkillStat(Character chr, int n)
    {
        StatRank rank = (StatRank)n;
        StatAttr sec  = Character.GetSecondaryStat(chr, rank);

        if (sec != StatAttr.STR && sec != StatAttr.CON)
        {
            return(sec);
        }
        rank = (rank + 1 <= StatRank.NICE ? rank + 1: rank);
        sec  = Character.GetSecondaryStat(chr, rank, sec);
        if (sec != StatAttr.STR && sec != StatAttr.CON)
        {
            return(sec);
        }
        rank = (rank + 1 <= StatRank.DUMP ? rank + 1 : rank);
        sec  = Character.GetSecondaryStat(chr, rank, sec);
        if (sec != StatAttr.STR && sec != StatAttr.CON)
        {
            return(sec);
        }
        rank = (rank + 1 <= StatRank.DUMP ? rank + 1 : rank);
        return(Character.GetSecondaryStat(chr, rank, sec));
    }
示例#5
0
 public static StatAttr GetSecondaryStat(Character chr, StatRank rank, StatAttr not)
 {
     return(StatGen.GetBestFor(chr.statGen, rank, not));
 }