private void LevelUp(SaveLoad saveLoad) { for (int i = 2; i < xpTable.Length; i++) { if (leveledTable[i] == false) { if (this.Experience >= xpTable[i]) { FightHelper.PlayEffect("levelUp"); this.MaxHealth += hpPerLvl; this.CurrentHealth = this.MaxHealth; this.MaxMana += manaPerLvl; this.CurrentMana = this.MaxMana; this.AttackDamage += attackDamagePerLvl; this.Strength += strengthPerLvl; this.SpellPower += spellPowerPerLvl; this.Defense += defensePerLvl; this.Level = i; leveledTable[i] = true; saveLoad.SaveGame(); } } } }
private static void HandleMonsterEncounter() { var monster = Pools.GetMonster(); ConsoleHelper.LogEnemyMessage("You have encountered a monster. It is an {0} {1}", monster.Title, monster.Name); ConsoleHelper.FilterInput("\nPress enter to face the enemy.", new ConsoleKey[] { ConsoleKey.Enter }); while (monster.Alive) { FightHelper.BattleTurn(ref monster); if (!GameInstance.Instance.CurrentPlayer.Alive) { FightHelper.HandleDeath(monster); break; } } if (GameInstance.Instance.CurrentPlayer.Alive) { FightHelper.ProcessVictory(monster); } }
public void BuyItem(Item item) { if (item.Gold > this.Gold) { MessageBox.Show("Not enough gold!", "!!!!!"); } else if (IsInventoryFull()) { MessageBox.Show("Not enough space!", "!!!!!"); } else { if (item.ID != "") { FightHelper.PlayEffect("shopBuy"); this.Gold -= item.Gold; AddItem(item); } } }
public void Update(MouseInput mouseInput, KeyboardInput keyboardInput) { #region Use Items Slots for (int i = 0; i < itemSlots.GetLength(0); i++) { for (int j = 0; j < itemSlots.GetLength(1); j++) { if (itemSlots[i, j].Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y) && mouseInput.IsLeftClicked()) { if (isInFight) { if (hero.Inventory[i, j].Type == "Potion") { FightHelper.UseItem(hero, i, j); this.fight.UsedItemPass(); } } else { FightHelper.UseItem(hero, i, j); } } } } #endregion #region Remove Equipment Button Update if (!isInFight) { if (remHead.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y)) { if (mouseInput.IsLeftClicked()) { hero.UnEquip(0); } else { itemToRem = 0; } } else if (remChest.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y)) { if (mouseInput.IsLeftClicked()) { hero.UnEquip(1); } else { itemToRem = 1; } } else if (remLegs.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y)) { if (mouseInput.IsLeftClicked()) { hero.UnEquip(2); } else { itemToRem = 2; } } else if (remFeets.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y)) { if (mouseInput.IsLeftClicked()) { hero.UnEquip(3); } else { itemToRem = 3; } } else if (remWeapon.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y)) { if (mouseInput.IsLeftClicked()) { hero.UnEquip(4); } else { itemToRem = 4; } } else { itemToRem = -1; } } #endregion #region Destroy Item for (int i = 0; i < itemSlots.GetLength(0); i++) { for (int j = 0; j < itemSlots.GetLength(1); j++) { if (itemSlots[i, j].Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y) && mouseInput.IsRightClicked()) { if (!isInFight) { this.hero.Inventory[i, j] = new Items.NullItem(Content); } } } } #endregion }