package com.lucasdnd.ags.gameplay.market;
import org.newdawn.slick.SlickException;
import com.lucasdnd.ags.system.GameSystem;
/**
* This is the representation for a game in the market. There will be one of these objects for each game available.
* @author tulio
*
*/
public class MarketGame extends Product {
protected MarketConsole marketConsole; // The Console this game refers to
protected int quality; // Quality of the game
protected boolean isUnlocked; // Indicates whether the player knows the demand of this game or not
protected int profitFromRent; // Profit from Rent
protected int profitFromSale; // Profit from Sale
protected int lifespan; // How many days it will stay in the market
protected int totalLifespan;
protected boolean isAvailable; // Is available to buy (past release date)
// Generation of customers related to this product
protected int customersToGenerate;
protected int maxCustomersToGenerate;
protected int everyXHours;
protected int currentGenerationHour = 1; // Start at 1 so a customer is not instantly created
/**
* Creates a Game that will become available for the player to buy.
* @param name
* @param console
* @param price
* @param quality
* @param releaseDate
* @throws SlickException
*/
public MarketGame(int id, String name, MarketConsole marketConsole, int difficulty, int price, int quality, long releaseDate) throws SlickException {
// Super Constructor (basic attributes only)
super(id, name, price, releaseDate);
// Specific attributes for the Game
this.marketConsole = marketConsole;
this.quality = quality;
// Demand is always unlocked in Easy difficulty
this.isUnlocked = difficulty == GameSystem.Difficulty.EASY;
// Calc the lifespan
switch(quality) {
case 0:
maxCustomersToGenerate = 3;
everyXHours = 8;
break;
case 1:
maxCustomersToGenerate = 5;
everyXHours = 8;
break;
case 2:
maxCustomersToGenerate = 7;
everyXHours = 6;
break;
case 3:
maxCustomersToGenerate = 10;
everyXHours = 6;
break;
case 4:
maxCustomersToGenerate = 15;
everyXHours = 4;
break;
}
customersToGenerate = maxCustomersToGenerate;
}
protected void decreaseLifespan() {
this.lifespan--;
}
public int getQuality() {
return quality;
}
public void setQuality(int quality) {
this.quality = quality;
}
public MarketConsole getMarketConsole() {
return marketConsole;
}
public void setMarketConsole(MarketConsole marketConsole) {
this.marketConsole = marketConsole;
}
public boolean isUnlocked() {
return isUnlocked;
}
public void setUnlocked(boolean isUnlocked) {
this.isUnlocked = isUnlocked;
}
public int getProfitFromRent() {
return profitFromRent;
}
public void setProfitFromRent(int profitFromRent) {
this.profitFromRent = profitFromRent;
}
public int getProfitFromSale() {
return profitFromSale;
}
public void setProfitFromSale(int profitFromSale) {
this.profitFromSale = profitFromSale;
}
public int getLifespan() {
return lifespan;
}
public void setLifespan(int lifespan) {
this.lifespan = lifespan;
}
public int getTotalLifespan() {
return totalLifespan;
}
public void setTotalLifespan(int totalLifespan) {
this.totalLifespan = totalLifespan;
}
}