Skip to content
Snippets Groups Projects
Commit 7ef99602 authored by Leonard's avatar Leonard
Browse files

changed alot

parent cf2769d6
No related branches found
No related tags found
No related merge requests found
Showing
with 310 additions and 111 deletions
File added
package com.galaxytrucker.galaxytruckerreloaded.Controller.Actions;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ClientControllerCommunicator {
/** Client ship */
......
......@@ -43,4 +43,9 @@ public abstract class System extends Room implements Serializable {
@DatabaseField(foreign = true, columnName = "crew")
@NonNull
private List<Crew> crew;
/** Whether or not the system is disabled */
@DatabaseField(columnName = "disabled")
@NonNull
private boolean disabled = false;
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class SystemNotFoundException extends Exception {
public class DuplicateRoomException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class DuplicateSystemException extends Exception {
public class DuplicateWeaponException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class RoomNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class WeaponNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.Room;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateRoomException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.RoomNotFoundException;
/** This class manages room objects in the database */
public class RoomDAO extends ObjectDAO<Room> {
/**
* Add a new room to the database
*
* @param r - the room to add
* @throws DuplicateRoomException if the system already exists in the database
*/
@Override
public void persist(Room r) throws DuplicateRoomException {
}
/**
* Edit an existing room in the database
*
* @param r - the room to edit
* @throws RoomNotFoundException if the room cannot be found in the database
*/
public void edit(Room r) throws RoomNotFoundException {
}
/**
* Remove an existing room from the database
*
* @param r - the room to remove
* @throws RoomNotFoundException if the room cannot be found in the database
*/
@Override
public void remove(Room r) throws RoomNotFoundException {
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateSystemException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.SystemNotFoundException;
public class SystemDAO extends ObjectDAO<System> {
/**
* Add a new system to the database
*
* @param s - the system to add
* @throws DuplicateSystemException if the system already exists in the database
*/
@Override
public void persist(System s) throws DuplicateSystemException {
}
/**
* Remove an existing system from the database
*
* @param s - the system to remove
* @throws SystemNotFoundException if the system cannot be found in the database
*/
@Override
public void remove(System s) throws SystemNotFoundException {
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateWeaponException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.WeaponNotFoundException;
/**
* This class manages weapons in the database
*/
public class WeaponDAO extends ObjectDAO<Weapon> {
/**
* Add a new weapon to the database
*
* @param w - the weapon to add
* @throws DuplicateWeaponException if the weapon already exists in the database
*/
@Override
public void persist(Weapon w) throws DuplicateWeaponException {
}
/**
* Edit an existing weapon in the database
*
* @param w - the weapon to edit
* @throws WeaponNotFoundException if the weapon doesn't exist in the database
*/
public void edit(Weapon w) throws WeaponNotFoundException {
}
/**
* Remove an existing weapon from the database
*
* @param w - the weapon to remove
* @throws WeaponNotFoundException if the weapon cannot be found in the database
*/
@Override
public void remove(Weapon w) throws WeaponNotFoundException {
}
}
......@@ -2,14 +2,36 @@ package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.Room;
import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.CrewDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.RoomDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.WeaponDAO;
import lombok.*;
/** This class handles battle logic on the server side */
@Getter
@Setter
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
public class BattleService {
/** ShipDAO */
@NonNull
private ShipDAO shipDAO;
/** WeaponDAO */
@NonNull
private WeaponDAO weaponDAO;
/** CrewDAO */
@NonNull
private CrewDAO crewDAO;
/** RoomDAO */
@NonNull
private RoomDAO roomDAO;
/** List of ships participating in the fight */
@NonNull
private List<Ship> participants;
......@@ -17,41 +39,45 @@ public class BattleService {
/** The ship which's round it is */
private Ship currentRound;
/** Disabled system round counter */
private int disabledSystemCounter = 3;
/** Change the ship which's round it is */
public void nextRound(){}
/** Validate user input by checking if it's his round to play
* @param s - the ship which wants to play
* @return true if it is it's round else false */
private boolean validMove(Ship s){
public boolean validMove(Ship s){
return false;
}
/** Make one ship attack another's section
* @param attacker - the attacking ship
* @param opponent - the opponent's ship
* @param weapon - the weapon attacking */
private void attack(Ship attacker, Ship opponent, Weapon weapon){}
* @param weapon - the weapon attacking
* @param room - the room being attacked */
public void attack(Ship attacker, Ship opponent, Weapon weapon, Room room){}
/** Heal a ship
* @param ship - the ship to heal
* @param healingWeapon - the healing weapon */
private void heal(Ship ship,Weapon healingWeapon){}
public void heal(Ship ship,Weapon healingWeapon){}
/** Flee a fight, reward the winner
* @param coward - the ship that wants to flee
* @param opponent - the opponent that wins the fight */
private void fleeFight(Ship coward, Ship opponent){}
public void fleeFight(Ship coward, Ship opponent){}
/** Give winner reward and end the fight (or the game)
* @param loser - the ship that lost
* @param victor - the ship that won */
private void endFight(Ship loser, Ship victor){}
public void endFight(Ship loser, Ship victor){}
/** Receive data from server and turn into valid battle move
* @param s - the string to turn to battle moves
* @return the outcome of the battle moves as a string command */
public String applyBattleMoves(String s){
return null;
/** Check if a ship is dead
* @param s - the ship
* @return true if the ship is dead else false */
public boolean isDead(Ship s){
return false;
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.CrewNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateCrewException;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.Room;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.CrewDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.RoomDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO;
import lombok.*;
/** This class handles the logic for crew aboard the ship, server side */
@Getter
@Setter
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
public class CrewService {
/**
* DAO
*/
/** ShipDAO */
@NonNull
private ShipDAO shipDAO;
/** CrewDAO */
@NonNull
private CrewDAO crewDAO;
/**
* Add a new crew member
*
* @param c - the crew member to add
* @throws DuplicateCrewException if the crew already exists
*/
public void addCrew(Crew c) throws DuplicateCrewException {
/** RoomDAO */
@NonNull
private RoomDAO roomDAO;
/** Validate the command given
* @param s - the given command
* @return true if it is valid, else false */
public boolean validateCrewMove(String s){
return false;
}
/** Move a crew member to a different section
* @param ship - the ship the crew is on
* @param crew - the crew member
* @param room - the room to move him to */
public void moveCrewToRoom(Ship ship, Crew crew, Room room){
}
/** Heal crew
* @param ship - the ship the crew is on
* @param crew - the crew member to heal
* @param healAmount - amount to heal */
public void healCrewMember(Ship ship,Crew crew,int healAmount){
}
/**
* Edit an existing crew member
*
* @param c - the crew member to edit
* @throws CrewNotFoundException if the crew cannot be found
*/
public void editCrew(Crew c) throws CrewNotFoundException {
/** Heal crew in a room
* @param ship - the ship the crew are on
* @param room - the room which's crew members to heal
* @param amount - amount to heal */
public void healCrewInRoom(Ship ship,Room room,int amount){
}
/** Damage crew
* @param ship - the ship the crew is on
* @param room - the room in which to damage the crew
* @param amount - the amount of damage to take */
public void damageCrew(Ship ship,Room room,int amount){
}
/**
* Remove an existing crew member
*
* @param c - the crew to remove
* @throws CrewNotFoundException if the crew cannot be found
*/
public void removeCrew(Crew c) throws CrewNotFoundException {
/** Fix a system
* @param ship - the ship to fix a system on
* @param system - the system to fix */
public void fixSystem(Ship ship, System system){
}
/** Repair a breach in a room
* @param ship - the ship to fix the rbeach on
* @param room - the room to fix the breach in */
public void repairBreach(Ship ship,Room room){
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Overworld;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateOverworldException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.OverworldNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.OverworldDAO;
public class OverworldService {
/**
* DAO
*/
private OverworldDAO overworldDAO;
/**
* Add a new OverWorld
*
* @param o - the OverWorld to add
* @throws DuplicateOverworldException if the OverWorld already exists
*/
public void addOverworld(Overworld o) throws DuplicateOverworldException {
}
/**
* Remove an existing OverWorld
*
* @param o - the OverWorld to remove
* @throws OverworldNotFoundException if the OverWorld cannot be found
*/
public void removeOverworld(Overworld o) throws OverworldNotFoundException {
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.Model.Weapons.Weapon;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.WeaponDAO;
import lombok.*;
/** This class handles reward handing to players */
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
@Getter
@Setter
public class RewardService {
/** ShipDAO */
@NonNull
private ShipDAO shipDAO;
/** WeaponDAO */
@NonNull
private WeaponDAO weaponDAO;
/** Weapon reward
* @param s - the ship to give reward to
* @param dropTable - possible weapon drops
* @return the weapon given */
public Weapon weaponReward(Ship s, List<Weapon> dropTable){
return null;
}
/** Coin reward
* @param s - the ship to give reward to
* @param c - the coins to give it */
public void coinsReward(Ship s, int c){
}
/** Fuel reward
* @param s - the ship to give reward to
* @param f - the fuel to give it*/
public void fuelReward(Ship s,int f){
}
/** Rocket reward
* @param s - the ship to give reward to
* @param r - the rockets to give it */
public void rocketReward(Ship s,int r){
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.Room;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.RoomDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO;
import lombok.*;
/** Handles the logic associated with a ships internal rooms and systems */
@Getter
@Setter
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
public class RoomService {
/** ShipDAO */
private ShipDAO shipDAO;
/** RoomDAO */
@NonNull
private RoomDAO roomDAO;
/** Cause a breach in a room
* @param ship - the ship the breach is happening on
* @param room - the room the breach is happening in */
public void causeBreach(Ship ship,Room room){}
/** Disable a system
* @param ship - the ship to disable a system on
* @param system - the system to disable */
public void disableSystem(Ship ship, System system){
}
/** Re-enable a system
* @param ship - the ship to re-enable a system on
* @param system - the system to re-enable */
public void reEnableSystem(Ship ship,System system){
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateSystemException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.SystemNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.SystemDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateRoomException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.RoomNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.RoomDAO;
public class SystemService {
/**
* System dao
*/
private SystemDAO systemDAO;
private RoomDAO roomDAO;
/**
* Add a new system
*
* @param s - the system to add
* @throws DuplicateSystemException if the system already exists
* @throws DuplicateRoomException if the system already exists
*/
public void addSystem(System s) throws DuplicateSystemException {
public void addSystem(System s) throws DuplicateRoomException {
}
/**
* Remove a system
*
* @param s - the system to remove
* @throws SystemNotFoundException if the system cannot be found
* @throws RoomNotFoundException if the system cannot be found
*/
public void removeSystem(System s) throws SystemNotFoundException {
public void removeSystem(System s) throws RoomNotFoundException {
}
}
......@@ -2,19 +2,24 @@ package com.galaxytrucker.galaxytruckerreloaded.Server.Services;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Planet;
import com.galaxytrucker.galaxytruckerreloaded.Model.Ship;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.PlanetDAO;
import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO;
import lombok.*;
/** Used to move user from one star to another */
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
@Getter
@Setter
@RequiredArgsConstructor(access = AccessLevel.PUBLIC)
public class TravelService {
/** ShipDAO for database access */
/** ShipDAO */
@NonNull
private ShipDAO shipDAO;
/** PlanetDAO */
@NonNull
private PlanetDAO planetDAO;
/** Validate the travel request
* @param s - the ship that wisches to travel
* @return true if the travel request is valid */
......
desktop/out/production/resources/badlogic.jpg

66.9 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment