package com.lucasdnd.ags.gameplay.market;
import java.util.Random;
import org.newdawn.slick.SpriteSheet;
public class MarketConsole extends MarketAsset implements Rentable {
protected int id; // Identifier
protected int quality;
protected int numberOfGames; // The number of games available on this Console
protected int playPrice; // Price estabilished by the Player to play this Console
// 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
protected boolean triggeredNewConsoleRelease;
public MarketConsole(int id, SpriteSheet spriteSheet, String name, int price, int quality, long releaseDate) {
super(id, spriteSheet, name, price, releaseDate, 1, 1, new int[]{1}, new int[]{0}, 1);
this.quality = quality;
playPrice = 100;
Random r = new Random();
// Lifespan and numberOfGames: refer to the balance sheet
int minGames = 0;
int maxGames = 0;
switch(quality) {
case 0:
minGames = 4;
maxGames = 8;
maxCustomersToGenerate = 20;
everyXHours = 8;
break;
case 1:
minGames = 6;
maxGames = 12;
maxCustomersToGenerate = 26;
everyXHours = 8;
break;
case 2:
minGames = 10;
maxGames = 16;
maxCustomersToGenerate = 32;
everyXHours = 8;
break;
case 3:
minGames = 14;
maxGames = 22;
maxCustomersToGenerate = 40;
everyXHours = 8;
break;
case 4:
minGames = 18;
maxGames = 30;
maxCustomersToGenerate = 52;
everyXHours = 8;
break;
}
customersToGenerate = maxCustomersToGenerate;
numberOfGames = r.nextInt(maxGames - minGames) + minGames;
}
/**
* Changes the play price
*/
@Override
public void changeRentPrice(int priceChange) {
if (priceChange == 10) {
// Check if we reached the price limit
if(playPrice < 2000) {
playPrice += priceChange;
}
} else if(priceChange == 50) {
// Check if we reached the price limit
if(playPrice < 1960) {
playPrice += priceChange;
}
} else if(priceChange == -10) {
// Check if we reached the price limit
if(playPrice > 10) {
playPrice += priceChange;
}
} else if(priceChange == -50) {
// Check if we reached the price limit
if(playPrice > 50) {
playPrice += priceChange;
}
}
}
public int getNumberOfGames() {
return numberOfGames;
}
public void setNumberOfGames(int numberOfGames) {
this.numberOfGames = numberOfGames;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPlayPrice() {
return playPrice;
}
public void setPlayPrice(int playPrice) {
this.playPrice = playPrice;
}
public int getQuality() {
return quality;
}
public void setQuality(int quality) {
this.quality = quality;
}
public boolean isTriggeredNewConsoleRelease() {
return triggeredNewConsoleRelease;
}
public void setTriggeredNewConsoleRelease(boolean triggeredNewConsoleRelease) {
this.triggeredNewConsoleRelease = triggeredNewConsoleRelease;
}
}