Exemplo n.º 1
0
        public static NPC_Model Create(NPC_Type	npcType, int techLevel, string shipModelName = null, int strengthBonus = 0)
        {
            strengthBonus +=
                  npcType == NPC_Type.Pirate ? (RNG.DiceSize - techLevel) / 2
                : npcType == NPC_Type.Police ? (techLevel+1) / 2
                : 0;

            var npcConfig = GameConfig.NPC_StatsConfigs[npcType];

            var model = new NPC_Model(npcType, shipModelName)
                {
                    Bounty	= RNG.GetNumber(npcConfig.Bounty),
                    Attack	= Tools.SetIntoRange(RNG.GetDice()   + npcConfig.Bonus_Attack  + strengthBonus, GameConfig.AttackRange.Min,  GameConfig.AttackRange.Max),
                    Defense = Tools.SetIntoRange(RNG.GetDice()-2 + npcConfig.Bonus_Defense + strengthBonus, GameConfig.DefenseRange.Min, GameConfig.DefenseRange.Max),
                    ECM		= RNG.GetDice() + strengthBonus > (RNG.DiceSize - npcConfig.Bonus_ECM) ? EquipmentState.Yes : EquipmentState.No,
                    EscapeChance = npcConfig.EscapeChance
                };

            if (npcType == NPC_Type.Trader)
            {
                model.CurrentCargo = new CargoStorage();
                var merchCount = Tools.SetIntoRange(model.Ship.MaxCargoLoad / 3, 1, 4);
                for (var i = 0; i < merchCount; i++)
                {
                    model.CurrentCargo[(Merchandise) RNG.GetDiceZero()] += RNG.GetDiceDiv2();
                }
            }

            return model;
        }
Exemplo n.º 2
0
        public string[] LoadTraits(NPC_Type selection)
        {
            int target = Behavior[selection];

            string[] traits = new string[NumberOfTraits];

            for (int i = 0; i < NumberOfTraits; i++)
            {
                traits[i] = NPC_Traits[target, i];
            }
            return(traits);
        }
Exemplo n.º 3
0
 private NPC_Model(NPC_Type npcType, string shipModelName = null)
 {
     var shipsUsage  = GameConfig.NPC_StatsConfigs[npcType].ShipsUsage;
     NPC_Type		= npcType;
     Name			= GameConfig.Get_NPC_Name(npcType);
     Ship			= shipModelName == null
                         ? GameConfig.ShipModels[RNG.GetNumber(shipsUsage.Min, shipsUsage.Max+1)]
                         : GameConfig.ShipModels.Single(a => a.ModelName == shipModelName);
     CurrentHP		= Tools.SetIntoRange(Ship.MaxHP - RNG.GetDiceZero(), Ship.MaxHP * 2 / 3, Ship.MaxHP);
     CurrentMissiles = RNG.GetNumber(Ship.MaxMissiles);
     IsRelevealedECM = false;
 }
Exemplo n.º 4
0
        public int[] LoadStats(NPC_Type selection)
        {
            int target = Behavior[selection];

            int[] stats = new int[NumberOfStats];

            for (int i = 0; i < NumberOfStats * 2 - 1; i += 2)
            {
                stats[i / 2] = random.Next(NPC_StatsRange[target, i], NPC_StatsRange[target, i + 1]);
            }

            return(stats);
        }
Exemplo n.º 5
0
 public static NPC_Model Create(NPC_Type	npcType, StarSystemModel system, string shipModelName = null)
 {
     return Create(npcType, system.TechLevel, shipModelName);
 }
Exemplo n.º 6
0
 public NPC(OverWorld ow, Tile t, NPC_Type vtype)
     : base(ow, t, 2)
 {
     type = vtype;
 }
Exemplo n.º 7
0
 public NPC(OverWorld ow, Tile t, int facing, NPC_Type vtype)
     : base(ow, t, facing)
 {
     type = vtype;
 }
Exemplo n.º 8
0
 private static NPC_StatsConfig Get_NPC_Config(Dictionary<string, string> lines, NPC_Type npcType)
 {
     var stats = lines[npcType.ToString()].Split(',').Select(a => a.Trim()).ToArray();
     return new NPC_StatsConfig
                {
                    Bounty		= Range.GetFromString(stats[0]),
                    ShipsUsage	= Range.GetFromString(stats[1]),
                    Bonus_Attack	= int.Parse(stats[2]),
                    Bonus_Defense= int.Parse(stats[3]),
                    Bonus_ECM	= int.Parse(stats[4]),
                    EscapeChance	= int.Parse(stats[5])
                };
 }
Exemplo n.º 9
0
 public static string Get_NPC_Name(NPC_Type npcType)
 {
     return npcType == NPC_Type.Alien
         ? alienNames[CurrentLanguageName][RNG.GetNumber(alienNames[CurrentLanguageName].Count)]
         : npcNames[CurrentLanguageName][RNG.GetNumber(npcNames[CurrentLanguageName].Count)];
 }