Ajout des cartes équipement
This commit is contained in:
@ -48,6 +48,11 @@ public class CreatingCardsTest {
|
||||
//Ange gardien
|
||||
try {
|
||||
|
||||
for(int i = 0; i < 67; i++) {
|
||||
DatabaseManager.queryInsertObject(i, null);
|
||||
}
|
||||
|
||||
|
||||
DatabaseManager.queryInsertObject(2,new CartePiochable(CartePiochable.Type.LUMIERE,
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_IMMUNITY, 1, true))));
|
||||
|
||||
@ -115,28 +120,33 @@ public class CreatingCardsTest {
|
||||
// Ténèbre
|
||||
|
||||
// Araignée Sanguinaire
|
||||
|
||||
DatabaseManager.queryInsertObject(17, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetCiblerTous(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
/*
|
||||
DatabaseManager.queryInsertObject(17, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetChoisirCible(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)))));
|
||||
|
||||
|
||||
// Chauve - souris vampire
|
||||
|
||||
DatabaseManager.queryInsertObject(18, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetCiblerTous(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
DatabaseManager.queryInsertObject(18, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetChoisirCible(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, 1, true)))));
|
||||
|
||||
DatabaseManager.queryInsertObject(19, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetCiblerTous(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
DatabaseManager.queryInsertObject(19, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetChoisirCible(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, 1, true)))));
|
||||
|
||||
DatabaseManager.queryInsertObject(20, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetCiblerTous(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
DatabaseManager.queryInsertObject(20, new CartePiochable(CartePiochable.Type.TENEBRE,new EffetMultiple(new EffetChoisirCible(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -2, true)),
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, 1, true)))));
|
||||
|
||||
*/
|
||||
// Dynamite
|
||||
|
||||
// 21
|
||||
|
||||
|
||||
// Hache tueuse
|
||||
for(int i = 0; i <= 2; i++) {
|
||||
DatabaseManager.queryInsertObject(22+i,new CarteEquipementStat(CartePiochable.Type.TENEBRE,
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_DAMAGE, 1, true))));
|
||||
}
|
||||
/*
|
||||
DatabaseManager.queryInsertObject(22,new CarteEquipementStat(CartePiochable.Type.TENEBRE,
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_DAMAGE, 1, true))));
|
||||
|
||||
@ -161,17 +171,18 @@ public class CreatingCardsTest {
|
||||
));
|
||||
|
||||
// 29
|
||||
|
||||
*/
|
||||
DatabaseManager.queryInsertObject(30,new CartePiochable(CartePiochable.Type.TENEBRE,
|
||||
new EffetChoisirCible(new ActionVoler(ActionVoler.VOLER))));
|
||||
|
||||
DatabaseManager.queryInsertObject(31,new CartePiochable(CartePiochable.Type.TENEBRE,
|
||||
new EffetChoisirCible(new ActionVoler(ActionVoler.VOLER))));
|
||||
|
||||
/*
|
||||
DatabaseManager.queryInsertObject(32,new CarteEquipementStat(CartePiochable.Type.TENEBRE,
|
||||
new EffetSelf(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_DAMAGE, 1, true))));
|
||||
|
||||
|
||||
*/
|
||||
// Vision clairvoyante
|
||||
DatabaseManager.queryInsertObject(33, new CarteVision(new ActionAltererStatistiquesJoueur(Joueur.PLAYER_HP, -1, true),
|
||||
new ConditionStatistiques(ConditionStatistiques.JOUEUR, Joueur.PLAYER_HP, 11, ConditionStatistiques.LESS)));
|
||||
|
@ -19,15 +19,20 @@ public class DatabaseManager {
|
||||
private final static String url = "jdbc:postgresql://localhost:5432/ShadowHunterDatabase";
|
||||
private final static String user = "shManager";
|
||||
private final static String password = "shadowhunter1234";
|
||||
|
||||
public static Connection connect() throws SQLException {
|
||||
return DriverManager.getConnection(url, user, password);
|
||||
}
|
||||
private static Connection connection;
|
||||
|
||||
public static void connect() throws SQLException {
|
||||
if(connection == null || connection.isClosed()) {
|
||||
connection = DriverManager.getConnection(url, user, password);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Record> remplirTable(String query) {
|
||||
List<Record> list = new ArrayList<Record>();
|
||||
try (Connection connection = connect()) {
|
||||
|
||||
|
||||
|
||||
try{
|
||||
connect();
|
||||
//System.out.println("Connected to PostgreSQL database!");
|
||||
Statement statement = connection.createStatement();
|
||||
//System.out.println("Reading records...");
|
||||
@ -44,8 +49,8 @@ public class DatabaseManager {
|
||||
|
||||
public static List<Record> remplirTableSansImage(String query) {
|
||||
List<Record> list = new ArrayList<Record>();
|
||||
try (Connection connection = connect()) {
|
||||
|
||||
try {
|
||||
connect();
|
||||
//System.out.println("Connected to PostgreSQL database!");
|
||||
Statement statement = connection.createStatement();
|
||||
//System.out.println("Reading records...");
|
||||
@ -93,8 +98,8 @@ public class DatabaseManager {
|
||||
query = "UPDATE " + table + " SET objet = ? "
|
||||
+ " WHERE id = ? " ;
|
||||
|
||||
Connection conn = connect();
|
||||
PreparedStatement pst = conn.prepareStatement(query);
|
||||
connect();
|
||||
PreparedStatement pst = connection.prepareStatement(query);
|
||||
pst.setBinaryStream(1, objectIS);
|
||||
pst.setInt(2, id);
|
||||
pst.executeUpdate();
|
||||
|
@ -58,8 +58,10 @@ public class RessourceLoader {
|
||||
|
||||
Record r = t.getList().get(i);
|
||||
byte[] obj = r.getObjet();
|
||||
if(obj != null) {
|
||||
Object o = deserialize(obj);
|
||||
Object o = deserialize(obj);
|
||||
if(o != null && o != null) {
|
||||
|
||||
|
||||
Carte c = (Carte)o;
|
||||
c.setNom(r.getNom());
|
||||
cartes.put(i+1, c);
|
||||
|
Reference in New Issue
Block a user