Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExMon

Simple elixir app for learning purposes. A turn-based game where a player can fight a Non-Playable Character (NPC). You can name your player and also your three different moves:

  • :move_avg - moderate attack (18-25 of damage)
  • :move_rnd - random attack (10-35 of damage)
  • :move_heal - heal power (18-25 of life)

After each move the updated stated of the game is displayed.

Example of use (IEx)

iex(1)> player = ExMon.create_player("Sonic", :bump, :dash, :charge)
%ExMon.Player{
  life: 100,
  name: "Sonic",
  moves: %{move_heal: :charge, move_avg: :bump, move_rnd: :dash}
}
iex(2)> ExMon.start_game(player)

====== Game started! ======

%{
  status: :started,
  player: %ExMon.Player{
    life: 100,
    name: "Sonic",
    moves: %{move_heal: :charge, move_avg: :bump, move_rnd: :dash}
  },
  turn: :player,
  npc: %ExMon.Player{
    life: 100,
    name: "Robotinik",
    moves: %{move_heal: :heal, move_avg: :punch, move_rnd: :kick}
  }
}
-------------------------------
:ok
iex(3)> ExMon.make_move(:bump)

====== NPC was attacked and take 19 of damage ======


====== It is NPC's turn! ======

%{
  status: :continue,
  player: %ExMon.Player{
    life: 100,
    name: "Sonic",
    moves: %{move_heal: :charge, move_avg: :bump, move_rnd: :dash}
  },
  turn: :npc,
  npc: %ExMon.Player{
    life: 81,
    name: "Robotinik",
    moves: %{move_heal: :heal, move_avg: :punch, move_rnd: :kick}
  }
}
-------------------------------

====== PLAYER was attacked and take 21 of damage ======


====== It is PLAYER's turn! ======

%{
  status: :continue,
  player: %ExMon.Player{
    life: 79,
    name: "Sonic",
    moves: %{move_heal: :charge, move_avg: :bump, move_rnd: :dash}
  },
  turn: :player,
  npc: %ExMon.Player{
    life: 81,
    name: "Robotinik",
    moves: %{move_heal: :heal, move_avg: :punch, move_rnd: :kick}
  }
}
-------------------------------
:ok
iex(4)>

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages