示例#1
0
    public KingdomTest(float populationGrowth, RACE race, List <CityTileTest> cities, Color tileColor, KingdomTileTest kingdomTile)
    {
        this.id          = GetID() + 1;
        this.kingdomName = "KINGDOM" + this.id;
        this.kingdomTile = kingdomTile;
        this.lord        = null;
//		this.lord = new Lord(this);
//		this.assignedLord = new Royalty (this, true);
        this.cities                   = cities;
        this.kingdomRace              = race;
        this.isDead                   = false;
        this.tileColor                = tileColor;
        this.relationshipKingdoms     = new List <RelationshipKingdoms>();
        this.expansionChance          = defaultExpansionChance;
        this.armyBaseUnits            = GetArmyBaseUnits();
        this.armyIncreaseUnits        = GetArmyIncreaseUnits();
        this.armyBaseStats            = GetArmyBaseStats();
        this.armyIncreaseStats        = GetArmyIncreaseStats();
        this.armyIncreaseUnitResource = GetArmyIncreaseUnitResource();
        this.royaltyList              = new RoyaltyList();
        this.marriedCouples           = new List <MarriedCouple>();

        SetLastID(this.id);
        DetermineCityUpgradeResourceType();
        CreateInitialRoyalties();
    }
示例#2
0
        //////////////////////////////////////////////////////
        //----Main Interface

        /// <summary>
        /// Class: Role
        /// 构造函数
        /// 设置人物的名字和初始种族 职业
        /// </summary>
        /// <param name="name"></param>
        /// <param name="player_race"></param>
        /// <param name="role_class"></param>
        public Role(String name, RACE player_race, CLASS role_class)
        {
            this.PLAYERNAME = name;
            //拷贝种族配置
            Race.instance.Selection(this, player_race);
            Class.instance.Selection(this, role_class);
        }
        public async Task <IActionResult> PutRACE(int id, RACE rACE)
        {
            if (id != rACE.idRace)
            {
                return(BadRequest());
            }

            _context.Entry(rACE).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RACEExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#4
0
        public static List <Record> CreateRace(CreatorConfig config)
        {
            var outputRecords = new List <Record>();

            if (!config.IsBodyPartsOnly)
            {
                var race = new RACE();
                race.NAME.EditorId    = String.IsNullOrEmpty(config.EditorId) ? "\0" : $"{config.EditorId}\0";
                race.FNAM.Name        = String.IsNullOrEmpty(config.EditorId) ? "\0" : $"{config.Name}\0";
                race.DESC.Description = String.IsNullOrEmpty(config.EditorId) ? "\0" : $"{config.Description}\0";
                outputRecords.Add(race);
            }

            if (config.IsMale)
            {
                outputRecords.AddRange(CreateBodyParts(config, true, bodyParts));
            }

            if (config.IsFemale)
            {
                outputRecords.AddRange(CreateBodyParts(config, false, bodyParts));
            }

            return(outputRecords);
        }
        public async Task <ActionResult <RACE> > PostRACE(RACE rACE)
        {
            _context.RACE.Add(rACE);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRACE", new { id = rACE.idRace }, rACE));
        }
示例#6
0
 public Kingdom(float populationGrowth, RACE race, List <CityTile> cities, string kingdomName, Color tileColor)
 {
     int[] traits = GenerateTraits();
     this.id                       = 1 + GetID();
     this.kingdomName              = kingdomName;
     this.populationGrowth         = populationGrowth;
     this.army                     = GenerateArmyPopulation();
     this.race                     = race;
     this.cities                   = cities;
     this.altruism                 = traits [0];
     this.ambition                 = traits [1];
     this.performance              = traits [2];
     this.performanceStorage       = this.performance;
     this.darkAgeCounter           = 0;
     this.darkAgeChance            = this.defaultDarkAgeChance;
     this.goldenAgeCounter         = 0;
     this.goldenAgeIncreaseCounter = 0;
     this.goldenAgeChance          = this.defaultGoldenAgeChance;
     this.tileColor                = tileColor;
     this.isDead                   = false;
     this.isInDarkAge              = false;
     this.isInGoldenAge            = false;
     this.adjacentKingdoms         = new List <KingdomTile> ();
     this.enemyKingdoms            = new List <KingdomTile> ();
     this.citiesGained             = new List <int> ();
     this.citiesLost               = new List <int> ();
     this.factions                 = new List <Faction> ();
     this.kingdomRelations         = new List <KingdomRelations> ();
     SetLastID(this.id);
 }
示例#7
0
//	public Faction(){
//		this.id = 0;
//		this.factionName = string.Empty;
//		this.race = RACE.HUMANS;
//		this.religion = null;
//		this.culture = null;
//	}
//	public Faction(Faction faction){
//		this.id = faction.id;
//		this.factionName = faction.factionName;
//		this.race = faction.race;
//		this.religion = faction.religion;
//		this.culture = faction.culture;
//	}
//	public object Clone(){
//		return new Faction {
//			id = this.id,
//			factionName = this.factionName,
//			race = this.race,
//			religion = this.religion,
//			culture = this.culture
//
//		};
//	}
    public void CopyData(Faction faction)
    {
        this.id          = faction.id;
        this.factionName = faction.factionName;
        this.race        = faction.race;
        this.religion    = faction.religion;
        this.culture     = faction.culture;
    }
示例#8
0
        public static string displayRace(RACE R, GAME G)
        {
            string sub = null;

            if (G == DND5e)
            {
                sub = displayRace5e(R);
            }

            return(sub);
        }
示例#9
0
        /// <summary>
        /// Class:Race
        /// 选择种族
        /// 调用内部方法修改参数的 基础分配率 和增长值
        /// </summary>
        /// <param name="role"></param>
        /// <param name="race"></param>
        public void Selection(Role role, RACE race)
        {
            switch (race)
            {
            case RACE.Angel:
                break;

            case RACE.Cyborg:
                break;

            case RACE.Demon:
                break;

            case RACE.Dwarf:
                break;

            case RACE.Elemental:
                break;

            case RACE.Elf:
                break;

            case RACE.Goblin:
                break;

            case RACE.Halfbeast:
                break;

            case RACE.Human:
                this.Human(role);
                break;

            case RACE.Orc:
                break;

            case RACE.Parasyte:
                break;

            case RACE.Spirit:
                break;

            case RACE.Troll:
                break;

            case RACE.Undead:
                break;

            case RACE.Underworld:
                break;
            }
        }
示例#10
0
    public KingdomTileTest CreateNewKingdom(RACE race, List <CityTileTest> initialCities)
    {
        GameObject goKingdom = (GameObject)GameObject.Instantiate(kingdomTilePrefab);

        goKingdom.transform.parent = this.transform;
        goKingdom.GetComponent <KingdomTileTest>().CreateKingdom(5f, race, initialCities, UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f));
        goKingdom.name = goKingdom.GetComponent <KingdomTileTest>().kingdom.kingdomName;
        this.kingdoms.Add(goKingdom.GetComponent <KingdomTileTest>());
        goKingdom.GetComponent <KingdomTileTest>().kingdom.lord.CreateInitialRelationshipsToLords();
        AddRelationshipToOtherLords(goKingdom.GetComponent <KingdomTileTest> ().kingdom.lord);
        GenerateCityConnections();
        UpdateLordAdjacency();
        return(goKingdom.GetComponent <KingdomTileTest>());
    }
    List <Resource> GetArmyCost(RACE race, int armyCount, int armyLvl)
    {
        List <Resource> upgradeCost = new List <Resource>();
        int             i, premiumResource = 0;

        switch (race)
        {
        case RACE.HUMANS:
            upgradeCost.Add(new Resource(RESOURCE.GOLD, 2000 + 200 * armyCount));
            upgradeCost.Add(new Resource(RESOURCE.STONE, 200 + 50 * armyCount));
            for (i = 1; i <= armyLvl; i++)
            {
                premiumResource += 100 * (i - 1);
            }
            upgradeCost.Add(new Resource(RESOURCE.METAL, premiumResource));
            return(upgradeCost);

        case RACE.ELVES:
            upgradeCost.Add(new Resource(RESOURCE.GOLD, 2000 + 400 * armyCount));
            upgradeCost.Add(new Resource(RESOURCE.LUMBER, 200 + 50 * armyCount));
            for (i = 1; i <= armyLvl; i++)
            {
                premiumResource += 200 * (i - 1);
            }
            upgradeCost.Add(new Resource(RESOURCE.MANA, premiumResource));
            return(upgradeCost);

        case RACE.MINGONS:
            upgradeCost.Add(new Resource(RESOURCE.GOLD, 2000 + 200 * armyCount));
            upgradeCost.Add(new Resource(RESOURCE.LUMBER, 200 + 25 * armyCount));
            for (i = 1; i <= armyLvl; i++)
            {
                premiumResource += 100 * (i - 1);
            }
            upgradeCost.Add(new Resource(RESOURCE.METAL, premiumResource));
            return(upgradeCost);

        case RACE.CROMADS:
            upgradeCost.Add(new Resource(RESOURCE.GOLD, 2000 + 400 * armyCount));
            upgradeCost.Add(new Resource(RESOURCE.STONE, 200 + 150 * armyCount));
            for (i = 1; i <= armyLvl; i++)
            {
                premiumResource += 200 * (i - 1);
            }
            upgradeCost.Add(new Resource(RESOURCE.MANA, premiumResource));
            return(upgradeCost);
        }
        return(upgradeCost);
    }
示例#12
0
        public static int DefStrength(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(10);

            case RACE.ARCHER:
                return(8);

            case RACE.MAGE:
                return(4);

            default:
                return(0);
            }
        }
示例#13
0
        public static int DefActualMana(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(600);

            case RACE.ARCHER:
                return(800);

            case RACE.MAGE:
                return(1000);

            default:
                return(0);
            }
        }
示例#14
0
        public static int DefRage(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(0);

            case RACE.ARCHER:
                return(0);

            case RACE.MAGE:
                return(0);

            default:
                return(0);
            }
        }
示例#15
0
        public static int DefInteligence(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(4);

            case RACE.ARCHER:
                return(6);

            case RACE.MAGE:
                return(12);

            default:
                return(0);
            }
        }
示例#16
0
        public static int DefPosY(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(15500);

            case RACE.ARCHER:
                return(15300);

            case RACE.MAGE:
                return(12000);

            default:
                return(0);
            }
        }
示例#17
0
        public static int DefPosX(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(15340);

            case RACE.ARCHER:
                return(15280);

            case RACE.MAGE:
                return(12400);

            default:
                return(0);
            }
        }
示例#18
0
        public static int DefAgility(RACE race)
        {
            switch (race)
            {
            case RACE.KNIGHT:
                return(8);

            case RACE.ARCHER:
                return(12);

            case RACE.MAGE:
                return(6);

            default:
                return(0);
            }
        }
    int GetAttackValue(RACE race, int armyLvl)
    {
        switch (race)
        {
        case RACE.HUMANS:
            return(30 + (4 * (armyLvl - 1)));

        case RACE.ELVES:
            return(50 + (10 * (armyLvl - 1)));

        case RACE.MINGONS:
            return(20 + (8 * (armyLvl - 1)));

        case RACE.CROMADS:
            return(40 + (15 * (armyLvl - 1)));
        }
        return(0);
    }
    int GetHPValue(RACE race, int armyLvl)
    {
        switch (race)
        {
        case RACE.HUMANS:
            return(200 + (40 * (armyLvl - 1)));

        case RACE.ELVES:
            return(200 + (20 * (armyLvl - 1)));

        case RACE.MINGONS:
            return(160 + (20 * (armyLvl - 1)));

        case RACE.CROMADS:
            return(400 + (60 * (armyLvl - 1)));
        }
        return(0);
    }
        int Side(RACE r)
        {
            switch (r)
            {
            case RACE.HUMAN:
            case RACE.NIGHT_ELF:
            case RACE.GNOME:
            case RACE.DWARF:
                return(1);

            case RACE.ORC:
            case RACE.UNDEAD:
            case RACE.TROLL:
            case RACE.TAUREN:
                return(2);
            }
            return(0);
        }
示例#22
0
        public static int DefRightHand(RACE race)
        {
            //item index
            switch (race)
            {
            case RACE.KNIGHT:
                return(10);

            case RACE.ARCHER:
                return(11);

            case RACE.MAGE:
                return(12);

            default:
                return(0);
            }
        }
    int GetUnitCount(RACE race, int armyCount)
    {
        switch (race)
        {
        case RACE.HUMANS:
            return(100 + (20 * armyCount));

        case RACE.ELVES:
            return(100 + (20 * armyCount));

        case RACE.MINGONS:
            return(100 + (20 * armyCount));

        case RACE.CROMADS:
            return(100 + (20 * armyCount));
        }
        return(0);
    }
示例#24
0
//	public string kingdomName;
//	public RACE race;
//	public float populationGrowth;
//	public float cityPopulation;
//	public int altruism;
//	public int ambition;
//	public int performance;
//	public List<CityTile> cities;


    public void CreateKingdom(float populationGrowth, RACE race, List <CityTile> cities, string kingdomName, Color tileColor)
    {
        this.kingdom = new Kingdom(populationGrowth, race, cities, kingdomName, tileColor);
        for (int i = 0; i < this.kingdom.cities.Count; i++)
        {
            this.kingdom.cities [i].cityAttributes.kingdomTile             = this;
            this.kingdom.cities [i].GetComponent <SpriteRenderer> ().color = this.kingdom.cities [i].cityAttributes.kingdomTile.kingdom.tileColor;
//			this.kingdom.cities [i].cityAttributes.faction = this.kingdom.factions [0];
        }
//		this.kingdom = kingdom;
//		this.cities = kingdom.cities;
//		this.race = kingdom.race;
//		this.populationGrowth = kingdom.populationGrowth;
//		this.cityPopulation = kingdom.cityPopulation;
//		this.altruism = kingdom.altruism;
//		this.ambition = kingdom.ambition;
//		this.performance = kingdom.performance;
//		this.kingdomName = kingdom.kingdomName;
    }
示例#25
0
        /// <summary>
        /// Class:Role
        /// 设置种族以及配置
        /// </summary>
        /// <param name="player_race"></param>
        public void setRace(RACE race, String race_description, double str_r_b, double str_g, double agi_r_b, double agi_g, double int_r_b, double int_g, double sta_r_b, double sta_g, double luc_r_b, double luc_g)
        {
            this.PLAYER_RACE             = race;
            this.PLAYER_RACE_DESCRIPTION = race_description;

            this.ma_dSTR_RACE_BONUS = str_r_b;
            this.ma_dSTR_G          = str_g;

            this.ma_dAGI_RACE_BONUS = agi_r_b;
            this.ma_dAGI_G          = agi_g;

            this.ma_dINT_RACE_BONUS = int_r_b;
            this.ma_dINT_G          = int_g;

            this.ma_dSTA_RACE_BONUS = sta_r_b;
            this.ma_dSTA_G          = sta_g;

            this.ma_dLUC_RACE_BONUS = luc_r_b;
            this.ma_dLUC_G          = luc_g;
        }
示例#26
0
        public Character(GAME G, int L, ROLLS R)
        {
            game  = G;
            level = L;

            rollType = R;
            Stats    = Rolling.RollStats(rollType);
            Mods     = Rolling.findMods(Stats);

            CClass = Class.RollClass(game);
            CRace  = race.RollRace(game);

            HP   = HPGold.RollHP(game, CClass, level);
            Gold = HPGold.RollGold(game, CClass);

            if (game == DND5e)
            {
                background = Background.RollBackground(game);
            }
        }
示例#27
0
        public static string displayRace5e(RACE R)
        {
            List <string> Races = collectRaces(DND5e);

            int irace = (int)R;

            string subRace = "";

            if (R == DRAGONBORN)
            {
                subRace = DragonBorn.getSubRace();
            }
            if (R == DWARF)
            {
                subRace = Dwarf.getSubRace();
            }
            if (R == ELF)
            {
                subRace = Elf.getSubRace();
            }
            if (R == GNOME)
            {
                subRace = Gnome.getSubRace();
            }
            if (R == HALFLING)
            {
                subRace = Halfling.getSubRace();
            }

            if (subRace != "")
            {
                frmref.RaceOutput.Text = Races[irace - 1] + "- " + subRace;
            }
            else
            {
                frmref.RaceOutput.Text = Races[irace - 1];
            }

            return(subRace);
        }
    void Update()
    {
        if (isSimulatingBattle)
        {
            return;
        }

        if (lblArmy1Count.text == String.Empty || lblArmy2Count.text == String.Empty ||
            lblArmy1Lvl.text == String.Empty || lblArmy2Lvl.text == String.Empty)
        {
            return;
        }

        lblTotalArmy1Cost.text = "[b]Army Cost:[/b] ";
        lblTotalArmy2Cost.text = "[b]Army Cost:[/b] ";
//		lblArmy1Units.text = "[b]Units:[/b] ";
//		lblArmy2Units.text = "[b]Units:[/b] ";

        army1Count = Int32.Parse(lblArmy1Count.text);
        army2Count = Int32.Parse(lblArmy2Count.text);

        army1Lvl = Int32.Parse(lblArmy1Lvl.text);
        army2Lvl = Int32.Parse(lblArmy2Lvl.text);

        army1Type = (ARMY_TYPE)Enum.Parse(typeof(ARMY_TYPE), lblArmy1Type.text);
        army2Type = (ARMY_TYPE)Enum.Parse(typeof(ARMY_TYPE), lblArmy2Type.text);

        army1Race = (RACE)Enum.Parse(typeof(RACE), lblArmy1Race.text);
        army2Race = (RACE)Enum.Parse(typeof(RACE), lblArmy2Race.text);

        List <Resource> army1Cost = GetArmyCost(army1Race, army1Count, army1Lvl);
        List <Resource> army2Cost = GetArmyCost(army2Race, army2Count, army2Lvl);

        army1Units = GetUnitCount(army1Race, army1Count);
        army2Units = GetUnitCount(army2Race, army2Count);

        army1HPPerUnit = GetHPValue(army1Race, army1Lvl);
        army2HPPerUnit = GetHPValue(army2Race, army2Lvl);

        army1ATK = GetAttackValue(army1Race, army1Lvl);
        army2ATK = GetAttackValue(army2Race, army2Lvl);

        totalArmy1ATK = army1Units * GetAttackValue(army1Race, army1Lvl);
        totalArmy2ATK = army2Units * GetAttackValue(army2Race, army2Lvl);

        if (army1Type == ARMY_TYPE.DEFENSIVE)
        {
            totalArmy1HP = (int)((army1Units * army1HPPerUnit) * 1.25f);
        }
        else
        {
            totalArmy1HP = army1Units * army1HPPerUnit;
        }

        if (army2Type == ARMY_TYPE.DEFENSIVE)
        {
            totalArmy2HP = (int)((army2Units * army2HPPerUnit) * 1.25f);
        }
        else
        {
            totalArmy2HP = army2Units * army2HPPerUnit;
        }

        for (int i = 0; i < army1Cost.Count; i++)
        {
            lblTotalArmy1Cost.text += army1Cost[i].resourceType.ToString() + " " + army1Cost[i].resourceQuantity.ToString() + " ";
        }

        for (int i = 0; i < army2Cost.Count; i++)
        {
            lblTotalArmy2Cost.text += army2Cost[i].resourceType.ToString() + " " + army2Cost[i].resourceQuantity.ToString() + " ";
        }


        lblArmy1Units.text = "[b]Units:[/b] " + army1Units.ToString();
        lblArmy2Units.text = "[b]Units:[/b] " + army2Units.ToString();

        lblArmy1HP.text = "[b]HP per unit:[/b] " + army1HPPerUnit.ToString();
        lblArmy2HP.text = "[b]HP per unit:[/b] " + army2HPPerUnit.ToString();

        lblArmy1ATK.text = "[b]ATK per unit:[/b] " + army1ATK.ToString();
        lblArmy2ATK.text = "[b]ATK per unit:[/b] " + army2ATK.ToString();

        lblArmy1HPTotal.text = "[b]Total HP:[/b] " + totalArmy1HP.ToString();
        lblArmy2HPTotal.text = "[b]Total HP:[/b] " + totalArmy2HP.ToString();

        lblArmy1ATKTotal.text = "[b]Total ATK:[/b] " + totalArmy1ATK.ToString();
        lblArmy2ATKTotal.text = "[b]Total ATK:[/b] " + totalArmy2ATK.ToString();
    }
示例#29
0
        static string FixMacro(string line)
        {
            int pos = line.IndexOf("//");

            if (pos >= 0)
            {
                line = line.Substring(0, pos);
            }
            pos = line.IndexOf(";");
            if (pos >= 0)
            {
                line = line.Substring(0, pos);
            }
            line = line.Trim();
            if (line == "")
            {
                return("");
            }

            int    start = 0;
            string ret   = line;

            while (start < line.Length)
            {
                pos = line.IndexOf('#', start);
                if (pos < 0)
                {
                    break;
                }
                start = pos + 1;

                int cnt = 0;
                while (cnt < 40)
                {
                    if (pos + cnt >= line.Length)
                    {
                        break;
                    }
                    char ch = line[pos + cnt];
                    if (ch == '#' || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_')
                    {
                        cnt++;
                    }
                    else
                    {
                        break;
                    }
                }
                string s = line.Substring(pos, cnt);
                if (s.StartsWith("#RACE_"))
                {
                    for (RACE t = RACE.HUMAN; t <= RACE.GOBLIN; t++)
                    {
                        if (s == "#RACE_" + t.ToString())
                        {
                            ret = ret.Replace(s, ((int)t).ToString());
                        }
                    }
                }
                else if (s.StartsWith("#CLASS_"))
                {
                    for (CLASS t = CLASS.WARRIOR; t <= CLASS.DRUID; t++)
                    {
                        if (s == "#CLASS_" + t.ToString())
                        {
                            ret = ret.Replace(s, ((int)t).ToString());
                        }
                    }
                }
                else
                {
                    ret = "";
                }
            }
            return(ret);
        }
示例#30
0
 public Player(String name, RACE player_race, CLASS role_class) : base(name, player_race, role_class)
 {
 }