public static bool Movement(Mob.moveDirection moving, int random) { switch (moving) { case Mob.moveDirection.up: global.player.Coord.Y -= 1; if (PCollision(random)) { global.player.Coord.Y += 1; return false; } else { return true; } case Mob.moveDirection.down: global.player.Coord.Y += 1; if (PCollision(random)) { global.player.Coord.Y -= 1; return false; } else { return true; } case Mob.moveDirection.left: global.player.Coord.X -= 1; if (PCollision(random)) { global.player.Coord.X += 1; return false; ; } else { return true; } case Mob.moveDirection.right: global.player.Coord.X += 1; if (PCollision(random)) { global.player.Coord.X -= 1; return false; } else return true; case Mob.moveDirection.none: //global.player.isAlive = false; //Console.Write(global.player.Coord.X + " " + global.player.Coord.Y); return false; default: return false; } }
public static void checkDamage(Mob attacker, Mob defender, int random) { Random random2 = new Random(); if (attacker.Coord == defender.Coord && ((attacker.Str + (random - 2)) - defender.Def) > 0) { defender.HP -= ((attacker.Str + (random - 2)) - defender.Def); if (defender.HP <= 0) { defender.isAlive = false; Write.print("You defeated the enemy!"); attacker.Exp += 5 * defender.Lvl; } else Write.print("Dealt " + ((attacker.Str + (random - 2)) - defender.Def) + " damage"); } else if (((attacker.Coord == defender.Coord && ((attacker.Str + (random - 2)) - defender.Def) <= 0))) { Write.print("You missed..."); } if (global.player.Exp >= global.player.Lvl * 5) { LevelUp(global.player, random2.Next(3, 6), random2.Next(0, 4), random2.Next(10, 20)); } }
public static void checkDamage(Mob attacker, Mob defender, int random, bool meaningless) { if (attacker.Coord == defender.Coord && ((attacker.Str + (random - 2)) - defender.Def) > 0) { defender.HP -= ((attacker.Str + (random - 2)) - defender.Def); if (defender.HP <= 0) { defender.isAlive = false; Write.print("You defeated the enemy!"); attacker.Exp += 5; } else Write.print("Monster dealt " + ((attacker.Str + (random - 2)) - defender.Def) + " damage"); } else if (((attacker.Coord == defender.Coord && ((attacker.Str + (random - 2)) - defender.Def) <= 0))) { Write.print("Monster missed..."); } }
public static Mob LevelUp(Mob player, int StrRand, int DefRand, int HPRand) { Random random = new Random(); player.Str += StrRand; player.Def += DefRand; player.MaxHP += HPRand; player.HP = player.MaxHP; player.Lvl += 1; player.Exp = 0; Write.print("Level up!"); return player; }