Minimal implementation for a classic 2D MMO-style game.
League of OOP is a game where 4 types of players move on a 2D board of different types of terrain and fight if 2 players meet in the same cell of the board. The players can fight based on 2 strategies: a healing one and an empowerment one. Angels start to show up on the map. There is an observer of the game called The Great Magician.
The types of players are as follows:
- Knight - Expert in body fighting, has 2 abilities: Execute and Slam
- Pyromancer - Fire master, has 2 abilities: Fireblast and Ignite
- Wizard - Superior mental capacity, has 2 abilities: Drain and Deflect
- Rogue - Sneak-attacker, has 2 abilities: Backstab and Paralysis
The types of terrain are as follows:
- Land - It gives the Knight a 15% bonus damage
- Volcanic - It gives the Pyromancer a 25% bonus damage
- Desert - It gives the Wizard a 10% damage increase
- Woods - It gives the Rogue the ability to Crit and a 15% bonus damage
There are 10 types of Angels:
- Damage Angel - Increases damage
- Dark Angel - Decreases HP
- Dracula - Decreases HP and Decreases Damage
- Good Boy - Increases HP and Increases Damage
- Level Up Angel - Gives the player necessary XP to level up
- Life Giver - Increases HP
- Small Angel - Increases HP and Increases Damage by a small amount
- Spawner Angel - Respawns the player with a specified HP
- The Doomer - Kills the player
- XP Angel - Gives the player an amount of XP
Implemented by: Andrei Pantelimon 325CA
This is how the input looks like:
You give the program the dimensions of the board, N strings of M length with letters corresponding to the name of the terrains. Next up you the to input the number of players and on the next P lines, a letter corresponding to the player type along with the coordinates that he will spawn in. Next up you input the number of rounds. Every round is described in P letters that indicate the direction that every player will move ('U' for up, 'D' for down, 'L' for left, 'R' for right, '_' for no movement). Finally you input the number of angels for every round and their type and position on the board.
And it will magically print the events seen by the Great Magician and the final results as shown in the second photo.
Compiling the program:
unzip FileIO.jar
javac -g main/Main.java
Note: You need to have the .jar file of the API inside the src folder.
Running it:
java main.Main "INPUT_FILE" "OUTPUT_FILE"
Project is made with IntelliJ Idea Community Edition in Java 12 with using only the FileIO API from the OOP team at the university.
Below is showed how a Pyromancer calculates the Fireblast abilty damage and applies it.
- It begins by calculating the ground modifier, if the player is located in a Volcano terrain
- The base damage is calculated
- Ground modifier is applied
- The damage is added to a variable that keeps the damage dealt to a potential Wizard if is present
- The race modifier is calculated and applied
- Final damage is applied and it declares the player as dead if he dies
Explaining in short terms:
- Input is read using the GameIOLoader class.
- Every player is instantiated in a list of players. They also get their own class based on their type.
- The game is played: 3.1. Board and players are initialized 3.2. Angels are added on the map 3.3. Every player takes Damage over Time and is declared dead if his hp drops below 0 (used in the next rounds) 3.4. Players are moved (only their coordinates are modified) 3.5. Board is reinitialized (players are cleared from their last round terrain and are reinitialized in the new board with the new coordinates). The actual objects of the players and the board do not actually modify (only some of their parameters). 3.6. Where there are 2 players in the same cell, they fight. 3.7. Angels visit the players 3.8. Players level up if necessary.
- Output seen by the Great Magician is written in the output file.
- In the tests there is a Float Error issue with Rogue and Pyromancer when calculating the damage, therefore needing to subtract the error to get the correct damage output.
- In the dense test, a player moves out of the map and comes back in with nothing happening to him, although there is specified that this could not happen.
- First Stage of the Project - Project description with necessary information
- Second Stage of the Project - Project description with necessary information
- FileIO API - Download and tutorial on how to use it
- Github - Andrei Pantelimon