Advertisement
Guest User

Untitled

a guest
Jul 7th, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.82 KB | None | 0 0
  1. import scala.util.Random
  2.  
  3. object something {
  4.     class Player(name: String) {
  5.     }
  6.  
  7.     class Pokemon(name: String) {
  8.         var hp = 100;
  9.         var dmg = 0.5;
  10.         var rand = new Random();
  11.        
  12.         def _attack(other: Pokemon) = {
  13.             val dmg = (10 + rand.nextInt(16)) * dmg;
  14.             other.hp -= dmg;
  15.             println(s"$name has attacked $other.hp for $dmg");
  16.         }
  17.         def _heal() = {
  18.             val healamnt = 10 + rand.nextInt(16);
  19.             hp += healamnt;
  20.             if (hp > 100) {
  21.                 hp = 100;
  22.             }
  23.             println(s"$name healed for $healamnt and is now $hp hp");
  24.         }
  25.        
  26.     }
  27.  
  28.     class TallGrass() {
  29.        
  30.         def enter() = {
  31.            
  32.         }
  33.     }
  34.  
  35.     def main(args: Array[String]) = {
  36.  
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement