diff --git a/src/Controller/Controller.java b/src/Controller/Controller.java index 3be73b6..6b0a1d9 100644 --- a/src/Controller/Controller.java +++ b/src/Controller/Controller.java @@ -640,9 +640,11 @@ else if (currentGame.getManaOfPlayers()[currentGame.getTurn()] < ((Unit) card).g currentGame.increaseCountOfFlagsInFlagsCollecting(); ((Unit)card).setHasFlag(true); ((Unit)card).addFlag(currentCell.getItems().get(i)); + currentCell.getItems().remove(currentCell.getItems().get(i)); } if(currentCell.getItems().get(i).isCollectAble()){ currentGame.addCollectableItems(currentCell.getItems().get(i)); + currentCell.getItems().remove(currentCell.getItems().get(i)); } } currentCell.setItems(null); @@ -746,9 +748,10 @@ public void createCustomUnit(String name, int type, Target target, int AP, int H ((Unit)card).setSpecialPowerCoolDown(specialPowerCoolDown); CardBuilder.createJsonFileFromTheObject(card); } - public Spell createCustomSpell(boolean stun, boolean disarm, boolean poison, int weakness, boolean fire, int attackChange, + public Spell createCustomSpell(String name, boolean stun, boolean disarm, boolean poison, int weakness, boolean fire, int attackChange, int HPChanger, boolean holyBuff, boolean deBuff, int attack, int changeMana, int rounds, boolean positive){ Spell spell = new Spell(); + spell.setName(name); spell.setStun(stun); spell.setDisarm(disarm); spell.setPoison(poison); @@ -764,10 +767,14 @@ public Spell createCustomSpell(boolean stun, boolean disarm, boolean poison, int spell.setPositive(positive); return spell; } - public void createCustomSpellCard(Spell spell, Target target, int manacost){ + public void createCustomSpellCard(Spell spell, Target target, int cost, int manaCost, String desc){ SpellCard card = new SpellCard(); + card.setName(spell.getName()); + spell.setName(null); card.setSpell(spell); - card.setManaCost(manacost); + card.setPrice(cost); + card.setDescription(desc); + card.setManaCost(manaCost); card.setTarget(target); CardBuilder.createJsonFileFromTheObject(card); } diff --git a/src/View/Viewer.java b/src/View/Viewer.java index 4a3b0ca..cc03adf 100644 --- a/src/View/Viewer.java +++ b/src/View/Viewer.java @@ -310,6 +310,16 @@ public void graphicShowCustomCard(){ positive.relocate(230,620); positive.setStyle("-fx-min-width: 105px;-fx-border-style: solid;-fx-border-width: 1px;-fx-border-color: #666;-fx-max-width: 105px;-fx-min-height: 37px;-fx-font-weight: bold;-fx-background-color: rgba(0,0,0,1);-fx-text-fill: white"); + TextField manaCost = new TextField(); + manaCost.setPromptText("manaCost"); + manaCost.relocate(390,220); + manaCost.setStyle("-fx-min-width: 105px;-fx-border-style: solid;-fx-border-width: 1px;-fx-border-color: #666;-fx-max-width: 105px;-fx-min-height: 37px;-fx-font-weight: bold;-fx-background-color: rgba(0,0,0,1);-fx-text-fill: white"); + + TextField desc = new TextField(); + desc.setPromptText("desc"); + desc.relocate(390,260); + desc.setStyle("-fx-min-width: 105px;-fx-border-style: solid;-fx-border-width: 1px;-fx-border-color: #666;-fx-max-width: 105px;-fx-min-height: 37px;-fx-font-weight: bold;-fx-background-color: rgba(0,0,0,1);-fx-text-fill: white"); + @@ -327,7 +337,7 @@ public void graphicShowCustomCard(){ createCustomCardBtn.setOnMouseClicked(mouseEvent -> { try { Target target = controller.createTarget(targetNum.getText(), targetGP.getText(), targetType.getText()); - Spell customSpell = controller.createCustomSpell(Boolean.parseBoolean(stun.getText()), Boolean.parseBoolean(disarm.getText()), + Spell customSpell = controller.createCustomSpell(name.getText(),Boolean.parseBoolean(stun.getText()), Boolean.parseBoolean(disarm.getText()), Boolean.parseBoolean(poison.getText()), Integer.parseInt(weaknes.getText()), Boolean.parseBoolean(fire.getText()), Integer.parseInt(attackChange.getText()), Integer.parseInt(HPChanger.getText()), Boolean.parseBoolean(holyBuff.getText()), Boolean.parseBoolean(deBuff.getText()), Integer.parseInt(attack.getText()), Integer.parseInt(changeMana.getText()), @@ -337,7 +347,7 @@ public void graphicShowCustomCard(){ Integer.parseInt(HP.getText()), attackType.getText(), Integer.parseInt(range.getText()) , customSpell, specialPowerCastTime.getText(), Integer.parseInt(specialPowerCoolDown.getText()), Integer.parseInt(cost.getText())); else if (custom.getText().toLowerCase().equals("spell")) - controller.createCustomSpellCard(customSpell, target, Integer.parseInt(cost.getText())); + controller.createCustomSpellCard(customSpell, target, Integer.parseInt(cost.getText()), Integer.parseInt(manaCost.getText()), desc.getText()); }catch (Exception e){ System.out.println("fill the form correctly!!!"); } @@ -354,7 +364,7 @@ else if (custom.getText().toLowerCase().equals("spell")) imageView.setPreserveRatio(true); group.getChildren().addAll(imageView,back,name,type,targetType,targetGP,AP,HP,attackType,range,specialPowerCastTime, specialPowerCoolDown,cost,createCustomCardBtn,spell,stun,disarm,poison,weaknes, fire, attackChange, - HPChanger,custom,holyBuff,deBuff,attack,changeMana,rounds,positive,targetNum); + HPChanger,custom,holyBuff,deBuff,attack,changeMana,rounds,positive,targetNum, manaCost, desc); } catch (Exception e){ System.err.println("Error While Showing Custom Card !");