public int initiative; // Represents your character’s ability to quickly attack when presented // with a hostile situation. At the beginning of each turn, each character // rolls for initiative just like in D n’ D. public void calculate(PrimaryStatistics stats, int level, int roll) { this.actionPoints = LHGCommon.getValueInRange(Math.Floor(stats.agility / 3.0) + Math.Floor(level / 3.0), 4, 27); this.criticalChance = LHGCommon.getValueInRange(stats.luck, 1, 10); this.hitPoints = LHGCommon.getValueInRange(20 + stats.vitality + (level * 3), 21, 120); this.resistance = LHGCommon.getValueInRange(5 + stats.vitality + (level / 2), 6, 30); this.accuracy = LHGCommon.getValueInRange(95 + stats.vision / 2, 95, 100); this.initiative = LHGCommon.getValueInRange(roll + stats.agility, 13, 22); }
public int speech; // Represents how good your character is at communicating with other // characters. Some characters can only be convinced to join you if // your speech skill level is high enough. public void calculate(PrimaryStatistics stats) { this.meleeWeapons = LHGCommon.getValueInRange(6 + (stats.strength * 2), 6, 100); this.guns = LHGCommon.getValueInRange(6 + (stats.agility * 2), 6, 100); this.explosives = LHGCommon.getValueInRange(6 + stats.agility + stats.vision, 6, 100); this.vehicularRepair = LHGCommon.getValueInRange(6 + (stats.utilization * 2), 6, 100); this.weaponMods = LHGCommon.getValueInRange(6 + stats.utilization + stats.resourcefulness, 6, 100); this.firstAid = LHGCommon.getValueInRange(6 + (stats.intelligence * 2), 6, 100); this.scavenge = LHGCommon.getValueInRange(6 + (stats.resourcefulness * 2), 6, 100); this.speech = LHGCommon.getValueInRange(6 + stats.intelligence + stats.vision, 6, 100); }
public RatingScreen(LunchHourGames lhg) : base(lhg, Type.PlayerRating) { this.stats = new PrimaryStatistics(); this.numberBoxes = new List <NumberBox>(); mouseStatePrevious = Mouse.GetState(); LoadContent(); TransitionPosition = 0; TransitionOnTime = TimeSpan.Zero; TransitionOffTime = new TimeSpan(0, 0, 2); // Allow 2 seconds for fade }
public Player createMainPlayer(string referenceName, string name, PrimaryStatistics stats) { LHGCommon.printToConsole("Creating main player " + name); Player player = createPlayerFromTemplate(referenceName); if (player.MyType == Player.Type.Human) { Human human = (Human)player; human.MyName = name; human.MyStats = stats; human.IsComputerControlled = false; human.IsMainPlayer = true; human.IsAlive = true; return(human); } return(null); }
public Player createPlayerForCombat(CombatBoard combatBoard, XmlNode playerNode) { string referenceName = playerNode.Attributes["referenceName"].Value; string name = playerNode.Attributes["name"].Value; progress.updateProgress("Creating player " + name + " for combat", "Loading", 0); Player player = createPlayerFromTemplate(referenceName); player.MyName = name; player.IsAlive = true; PrimaryStatistics stats = null; CombatLocation location = null; XmlNodeList childNodes = playerNode.ChildNodes; foreach (XmlNode childNode in childNodes) { switch (childNode.Name) { case "stats": progress.updateProgress("Loading " + name + " stats", "Loading", 0); stats = loadStats(childNode); break; case "location": progress.updateProgress("Loading " + name + " location", "Loading", 0); location = loadCombatLocation(combatBoard, player, childNode); break; } } player.Location = location; return(player); }
public Human(LunchHourGames lhg, String templateName, String name, PlayerSprite sprite) : base(lhg, templateName, name, Type.Human, false, sprite) { this.stats = new PrimaryStatistics(); this.skills = new Skills(); }
private Player createPlayerFromTemplate(string referenceName) { Player player = null; if (playersDocument == null) { this.playersDocument = new XmlDocument(); playersDocument.Load("Content/Xml/players.xml"); } // Check to see if the player template is in our cache already. Player cachedPlayer = lhg.Assets.findPlayerTemplateInCache(referenceName); if (cachedPlayer != null) { progress.updateProgress("Loading player template " + referenceName + " from cache", "Loading", 0); return(createQuickCopy(cachedPlayer)); } else { progress.updateProgress("Loading player template " + referenceName + " from disk", "Loading", 0); string xpath = "/players/player[@referenceName='" + referenceName + "']"; XmlNode playerNode = playersDocument.SelectSingleNode(xpath); if (playerNode != null) { PrimaryStatistics stats = null; List <PlayerSpriteSheet> playerSpriteSheetList = null; StaticSprite hudSprite = null; InventoryStorage inventoryStorage = null; Player.Type type = Player.getTypeFromString(playerNode.Attributes["type"].Value); XmlNodeList playerChildren = playerNode.ChildNodes; foreach (XmlNode childNode in playerChildren) { switch (childNode.Name) { case "stats": stats = loadStats(childNode); break; case "hud": hudSprite = loadCombatHUDSprite(childNode); break; case "animations": playerSpriteSheetList = loadAnimations(childNode); break; case "inventory": inventoryStorage = loadInventory(childNode); break; } } PlayerSprite playerSprite = new PlayerSprite(lhg, playerSpriteSheetList, PlayerSpriteSheet.Type.Standing); // Create a player for our cache that won't change, so we can quickly create copies if (type == Player.Type.Human) { cachedPlayer = new Human(lhg, referenceName, referenceName, playerSprite); } else if (type == Player.Type.Zombie) { cachedPlayer = new Zombie(lhg, referenceName, referenceName, playerSprite); } cachedPlayer.MyHUDSprite = hudSprite; cachedPlayer.MyInventory = inventoryStorage; lhg.Assets.addPlayerTemplate(cachedPlayer); // Now, create a copy we will use as the real instance player = createQuickCopy(cachedPlayer); } } return(player); }