public void AttackCurrentMonster() { if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("Musíš si zvolit zbraň, abys mohl útočit!"); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); if (CurrentMonster.IsDead) { // Get another monster to fight GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
public void AttackCurrentMonster() { if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon to attack with."); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); // If monster killed, collect rewards/loot if (CurrentMonster.IsDead) { // Generate new monster to fight GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
public void ProcessMultiplayerDamage(BatchedClick damage) { int totalDamageToProcess = damage.GetDamage(); if (CurrentMonster.GetHealth() >= totalDamageToProcess) { MonsterClickProcessor(totalDamageToProcess); } else { while (totalDamageToProcess > 0) { int damageForCurrentMonster = CurrentMonster.GetHealth(); int damageToDo = totalDamageToProcess - damageForCurrentMonster; if (damageToDo <= 0) { MonsterClickProcessor(damageToDo); break; } totalDamageToProcess -= damageToDo; MonsterClickProcessor(damageToDo); } } }
private void MonsterClickProcessor(int damage) { CurrentMonster?.DoDamage(damage); //actually attack the monster NotifyPropertyChanged("MonsterHealthPercentage"); if (CurrentMonster.IsDefeated()) { //get the rewards for this monster and generate a new level var rewards = CurrentMonster.GetReward(); for (ulong i = 0; i < rewards.SparkCoin; i++) { CreateCoin(typeof(SparkCoin), rewards.Factor); } for (ulong i = 0; i < rewards.EuropeanCredit; i++) { CreateCoin(typeof(EuropeanCredit), 0); } UpdatePlayerStatsAfterMonsterDefeat(true); //build a new level from the current player list, in singleplayer mode that list contains 1 player. RenderLevel(); OnMonsterDefeated?.Invoke(CurrentMonster, null); } }
public void AttackCurrentMonster() { if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon, to attack."); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); // If monster if killed, collect rewards and loot if (CurrentMonster.IsDead) { // RaiseMessage($"You have killed the {CurrentMonster.Name}!"); // Get another monster to fight GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
/* * ======================================================================================== * Flee ---> Try to run from monster (if fails to flee hero is still in the fight) * ======================================================================================== */ private void Flee() { int randNum = Random.Next(0, 100); int chance = CurrentMonster.GetRunAwayChance(CurrentMonster); bool hasFled = false; if (randNum <= chance) { hasFled = true; } else if (randNum > chance) { hasFled = false; } else { throw new Exception("Oof"); } if (hasFled) { CurrentMonster.CurrentHP -= CurrentMonster.CurrentHP; // This will skip past the while loop in Start() Win(WinConditionEnum.Flee); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("You have failed to flee the battle"); Console.ResetColor(); MonsterTurn(); } }
public void ResetEmotion() { if (CurrentMonster != null) { CurrentMonster.ResetEmotion(); } }
public void AttackCurrentMonster() { if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage(Emote.MOCKING, "You must select a weapon, to attack."); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); if (CurrentMonster.IsDead) { // Get another monster to fight GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
public void AttackCurrentMonster() { //guard clause, or early exit if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon to attack."); return; } //Determine damage to monsters CurrentPlayer.UseCurrentWeapon(CurrentMonster); //if monster is killed, collect xp and loot if (CurrentMonster.IsDead) { GetMonsterAtLocaion(); } else { //if monster is still alive, monster attacks you CurrentMonster.UseCurrentWeapon(CurrentPlayer); } }
public void AttackCurrentMonster() { if (CurrentMonster == null) { RaiseMessage("There is no one to attack here."); return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon, to attack."); return; } CurrentPlayer.UseCurrentWeapon(CurrentMonster); // If monster if killed, collect rewards and loot if (CurrentMonster.IsDead) { GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeapon(CurrentPlayer); } }
public void MagicAttackCurrentMonster() { // Checks to make sure a Monster is on the location if (CurrentMonster == null) { RaiseMessage("Just who are you trying to Magically Attack?"); return; } // If there is no current spell it will give this error if (CurrentPlayer.CurrentSpell == null) { RaiseMessage("You must select a spell, to do the magics."); return; } CurrentPlayer.UseCurrentSpell(CurrentMonster); // If monster if killed, collect rewards and loot if (CurrentMonster.IsDead) { GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeapon(CurrentPlayer); } }
public void AttackCurrentMonster() { if (CurrentPlayer.CurrentWeapon == null) // Guard clause! - we will not run all stuff below if player doesn't have weapon equiped! { RaiseMessage("Mighty Hero! You must select a weapon, to attack."); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); // If monster is killed, collect rewards and loot if (CurrentMonster.IsDead) { } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster} points."); CurrentMonster.TakeDamage(damageToMonster); } // If monster is killed, collect rewards and loot if (CurrentMonster.IsDead) { } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster} points."); CurrentMonster.TakeDamage(damageToMonster); } // If monster is killed, collect rewards and loot if (CurrentMonster.IsDead) { // Get another monster to fight GetMonsterAtLocation(); } else { // Let the monster attack int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage($"The {CurrentMonster.Name} attacks, but misses you."); } else { RaiseMessage($"The {CurrentMonster.Name} hit you for {damageToPlayer} points."); CurrentPlayer.TakeDamage(damageToPlayer); } } }
void AddSkillButtonClicked(object sender, EventArgs e) { SkillValue v = new SkillValue(_SelectedSkill); if (_OptionsSkills.Contains(_SelectedSkill)) { v.Subtype = _DetailText.Trim().ToLower(); } if (!CurrentMonster.SkillValueDictionary.ContainsKey(v.FullName)) { CurrentMonster.AddOrChangeSkill(v.Name, v.Subtype, 0); UpdateSelectableSkills(); } }
private void AddClicked(Feat feat) { string name = feat.Name; if (feat.AltName != null && feat.AltName.Length > 0) { name = feat.AltName; } if (!CurrentMonster.FeatsList.Contains(name)) { CurrentMonster.AddFeat(name); _CurrentFeats.Add(new ParsedFeat(name)); CurrentFeatsView.ReloadData(); } }
// Not Implemented yet // private int TotalHeroPoints { get; } /* * ======================================================================================== * Fight ---> Initializes the fight and selects a random monster from today's monsters * ======================================================================================== */ public Fight(HandleAchievements manageAchievements, Hero hero) { Hero = hero; Random = new Random(); ManageAchievements = manageAchievements; // Not Implemented yet // TODO: use this to up the difficulty for the monsters // TotalHeroPoints = Hero.OriginalHP + Hero.Strength + Hero.Defense; Monsters = new List <Monster>(GetTodaysMonsters()); CurrentMonster = Monsters[Random.Next(0, Monsters.Count)]; MonstersEXPWorth = CurrentMonster.GetMonstersEXPWorth(); MonstersGoldCoinWorth = CurrentMonster.GetMonstersGoldCoinWorth(); }
public void AttackCurrentMonster() { if (CurrentWeapon == null) { RaiseMessage("You must select a weapon, to attack"); return; } // Determine damage to monster int damageToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage); if (damageToMonster == 0) { RaiseMessage($"You missed the {CurrentMonster.Name}."); } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster} points"); CurrentMonster.TakeDamage(damageToMonster); } // If monster is killed, collect rewards and loot if (CurrentMonster.IsDead) { // Get another monster to fight GetMonsterAtLocation(); } else { // If monster is still alive, let the monster attack int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage($"The {CurrentMonster.Name} attacks, but misses you."); } else { RaiseMessage($"The {CurrentMonster.Name} hit you for {damageToPlayer} points."); CurrentPlayer.TakeDamage(damageToPlayer); } } }
public void MonsterAttack() { if (GameEnd) { return; } if (CurrentMonster != null) { var damage = CurrentMonster.Attack(); CurrentPlayer.Lives -= damage; if (CurrentPlayer.Lives <= 0) { CurrentPlayer.Lives = 0; CurrentAction = Code.GameAction.GameOver; GameEnd = true; } } CheckStatus(); }
public void AttackCurrentMonster() { if (CurrentWeapon == null) { // If player does not have a weapon to attack. RaiseMessage("You must select a weapon, to attack."); return; } // Determine damage to monster int damageToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage); if (damageToMonster == 0) { RaiseMessage($"You missed the {CurrentMonster.Name}."); } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster} points."); CurrentMonster.TakeDamage(damageToMonster); } if (CurrentMonster.IsDead) { // Spawn a new monster to fight GetMonsterAtLocation(); } else { // Let the monster attack int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage("The monster attacks, but misses you."); } else { RaiseMessage($"{CurrentMonster.Name} did {damageToPlayer} points of damage."); CurrentPlayer.TakeDamage(damageToPlayer); } } }
public void AttackCurrentMonster() { if (CurrentWeapon == null) { RaiseMessage("You must select a weapon to attack!"); return; } // Determine damage to the monster int damageToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage); if (damageToMonster == 0) { RaiseMessage($"You missed the {CurrentMonster.Name}!"); } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster}!"); CurrentMonster.TakeDamage(damageToMonster); } if (CurrentMonster.IsDead) { //Spawn new monster GetMonsterAtLocation(); } else { //Monster attacks the player int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage($"The {CurrentMonster.Name} attacks but misses you."); } else { RaiseMessage($"The {CurrentMonster.Name} hits you for {damageToPlayer}."); CurrentPlayer.TakeDamage(damageToPlayer); } } }
public void AttackCurrentMonster() { if (CurrentWeapon == null) { RaiseMessage("You must select a weapon to attack."); return; } int damageToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage); if (damageToMonster == 0) { RaiseMessage($"You missed the {CurrentMonster.Name}."); } else { RaiseMessage($"You hit the {CurrentMonster.Name} for {damageToMonster}"); CurrentMonster.TakeDamage(damageToMonster); } if (CurrentMonster.IsDead) { GetMonsterAtLocation(); } else { int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage("The monster attacks, but misses you."); } else { RaiseMessage($"The {CurrentMonster.Name} hit you for {damageToPlayer} points."); CurrentPlayer.TakeDamage(damageToPlayer); } } }
public void AttackCurrentMonster() { if (CurrentWeapon == null) { RaiseMessage("Moras odabrat weapon da udaras"); return; } int damageToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage); if (damageToMonster == 0) { RaiseMessage($"Promasio si {CurrentMonster.Name}."); } else { RaiseMessage(""); RaiseMessage($"Udario si {CurrentMonster.Name} za {damageToMonster}."); CurrentMonster.TakeDamage(damageToMonster); } if (CurrentMonster.IsDead) { GetMonsterAtLocation(); } else { int damageToPlayer = RandomNumberGenerator.NumberBetween(CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage); if (damageToPlayer == 0) { RaiseMessage("Monster je promasio hehe gade srecni"); } else { RaiseMessage($"{CurrentMonster.Name} te udario za {damageToPlayer}"); CurrentPlayer.TakeDamage(damageToPlayer); } } }
public void AttackCurrentMonster() { if (CurrentMonster == null) { return; } if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon to attack!"); return; } CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); if (CurrentMonster.IsDead) { GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
public void AttackCurrentMonster() { if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon, to attack."); return; } // Determine damage to monster CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); if (CurrentMonster.IsDead) { // Get another monster to fight GetMonsterAtLocation(); } else { // Let the monster attack CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
public void AttackCurrentMonster() { // Guard Clause - Så man kan ikke angrebe og skabe fejl hvis man ikke har et våben valgt. if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You must select a weapon to be able to attack"); return; } //Damage to monster CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); // Når monster dør if (CurrentMonster.IsDead) { // Derefter nyt monster GetMonsterAtLocation(); } else { // Monster angriber CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
/// <summary> /// Most important function that handles all the game clicks /// </summary> public void MonsterClicked() { //check if there is a monster to click on: if (CurrentMonster != null) { //execute pending abilities AbilityMultiplier = 1; OnClickAbilityProcess?.Invoke(CurrentLevel, Clicks); int damage = 100 * CurrentPlayer.GetDamageFactor() * AbilityMultiplier; if (CurrentMonster.GetHealth() >= damage) { Clicks.AddDamage(damage); MonsterClickProcessor(damage); } else { while (damage > 0) { int CurrentMonsterHealth = CurrentMonster.GetHealth(); int damageToDo = damage - CurrentMonsterHealth; if (damageToDo <= 0) { //to process the last bits of damage without the loop Clicks.AddDamage(damage); MonsterClickProcessor(damage); break; } damage -= damageToDo; Clicks.AddDamage(damageToDo); MonsterClickProcessor(damageToDo); } } } }
public void AttackCurrentMonster() { //TODO change to fists? But type of logic is guard clause called early exit. if (CurrentPlayer.CurrentWeapon == null) { RaiseMessage("You Must select a weapon, to attack."); return; } //Determine damage to monster CurrentPlayer.UseCurrentWeaponOn(CurrentMonster); if (CurrentMonster.IsDead) { //Get another monster to fight GetMonsterAtLocation(); } else { CurrentMonster.UseCurrentWeaponOn(CurrentPlayer); } }
//I want to modify this function such that Weapon damage is doubled when the d20 roll is a 20 //I probably need to make a local variable in PlayerAccuracyCalculations to hold the roll, then call it here. //Then, I'd make a check for whether or not it was a nat20 public void PlayerAttackDamageCalculation() { int damageDealtToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage) + StatisticsCalculator.AbilityScoreCalculator(CurrentPlayer.Strength); PlayerAttackSuccessNotification(damageDealtToMonster); CurrentMonster.TakeDamage(damageDealtToMonster); if (CurrentMonster.IsDead) { CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints); CurrentPlayer.ReceiveGold(CurrentMonster.Gold); foreach (GameItem gameItem in CurrentMonster.Inventory) { CurrentPlayer.AddItemToInventory(gameItem); } GetMonsterAtLocation(); return; } else //Monster's Turn { MonsterAccuracyCalculation(); if (MonsterAccuracyCalculation()) { MonsterAttackDamageCalculation(); } else { MonsterAttackFailureNotification(); } } }
/* * ======================================================================================== * Start ---> Fight menu (choose to fight, see stats, or maybe more options in the future) * ======================================================================================== */ public void Start() { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"\nA {CurrentMonster.Name}! (Strength = {CurrentMonster.Strength} | Defense = {CurrentMonster.Defense} | HP = {CurrentMonster.CurrentHP})"); Console.ResetColor(); while (CurrentMonster.CurrentHP > 0 && Hero.CurrentHP > 0) { Console.Title = $"FIGHT!!! ({Hero.Name} vs {CurrentMonster.Name}) Stats: [> Str: {Hero.Strength} | Def: {Hero.Defense} | HP: {Hero.CurrentHP}/{Hero.OriginalHP} <] | Enemy Current HP: {CurrentMonster.CurrentHP}"; Console.WriteLine($"\nWhat will you do?"); Console.WriteLine("1. Fight"); Console.WriteLine("2. Use Health Potion"); Console.WriteLine("3. Flee"); Console.WriteLine("4. See The Enemy's Status and Your Status"); string input = Console.ReadLine().Trim(); if (input == "1") { HeroTurn(); } else if (input == "2") { UseHealthPotion(); } else if (input == "3") { Flee(); } else if (input == "4") { Hero.ShowStats(false); CurrentMonster.ShowStats(); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); foreach (GradientView v in new GradientView[] { SpeedView, AttacksView, AbilitiesView }) { StylePanel(v); } CurrentMonster.Adjuster.PropertyChanged += MonsterAdjusterPropertyChanged; ButtonPropertyManager m; m = new ButtonPropertyManager(SpeedButton, DialogParent, CurrentMonster.Adjuster, "LandSpeed") { Title = "Land Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(ClimbButton, DialogParent, CurrentMonster.Adjuster, "ClimbSpeed") { Title = "Climb Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(SpaceButton, DialogParent, CurrentMonster.Adjuster, "Space") { Title = "Space" }; _Managers.Add(m); m = new ButtonPropertyManager(FlyButton, DialogParent, CurrentMonster.Adjuster, "FlySpeed") { Title = "Fly Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(BurrowButton, DialogParent, CurrentMonster.Adjuster, "BurrowSpeed") { Title = "Burrow Speed", MinIntValue = 0 }; _Managers.Add(m); m = new ButtonPropertyManager(ReachButton, DialogParent, CurrentMonster.Adjuster, "Reach") { Title = "Reach" }; _Managers.Add(m); m = new ButtonPropertyManager(FlyQualityButton, DialogParent, CurrentMonster.Adjuster, "FlyQuality") { Title = "Fly Quality" }; var list = new List <KeyValuePair <object, string> >(); for (int i = 0; i < 5; i++) { list.Add(new KeyValuePair <object, string>(i, Monster.GetFlyQualityString(i).Capitalize())); } m.ValueList = list; m.FormatDelegate = a => { if (CurrentMonster.Adjuster.FlySpeed == null) { return("-"); } else { return(Monster.GetFlyQualityString((int)a).Capitalize()); } }; _Managers.Add(m); m = new ButtonPropertyManager(SwimButton, DialogParent, CurrentMonster.Adjuster, "SwimSpeed") { Title = "Swim Speed" }; _Managers.Add(m); m = new ButtonPropertyManager(SpecialAttacksButton, DialogParent, CurrentMonster, "SpecialAttacks") { Title = "Special Attacks", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellLikeAbilitiesButton, DialogParent, CurrentMonster.Adjuster, "SpellLikeAbilities") { Title = "Spell-Like Abilities", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellsKnownButton, DialogParent, CurrentMonster.Adjuster, "SpellsKnown") { Title = "Spells Known", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(SpellsPreparedButton, DialogParent, CurrentMonster.Adjuster, "SpellsPrepared") { Title = "SpellsPrepared", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(MeleeButton, DialogParent, CurrentMonster, "Melee") { Title = "Melee", Multiline = true }; _Managers.Add(m); m = new ButtonPropertyManager(RangedButton, DialogParent, CurrentMonster, "Ranged") { Title = "Ranged", Multiline = true }; _Managers.Add(m); foreach (GradientButton b in from x in _Managers select x.Button) { CMStyles.TextFieldStyle(b, 15f); } AttacksEditorButton.TouchUpInside += (sender, e) => { _AEDialog = new AttacksEditorDialog(CurrentMonster); _AEDialog.OKClicked += (senderx, e1) => { CharacterAttacks at = _AEDialog.Attacks; CurrentMonster.Melee = CurrentMonster.MeleeString(at); CurrentMonster.Ranged = CurrentMonster.RangedString(at); }; DialogParent.Add(_AEDialog.View); }; UpdateButtonState(); }