Skip to content

Commit

Permalink
custom spellcard debug
Browse files Browse the repository at this point in the history
  • Loading branch information
alikmr committed Jul 6, 2019
1 parent bcd7e51 commit 8b24f73
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/Controller/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
16 changes: 13 additions & 3 deletions src/View/Viewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,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");




Expand All @@ -331,7 +341,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()),
Expand All @@ -341,7 +351,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!!!");
}
Expand All @@ -358,7 +368,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 !");
Expand Down

0 comments on commit 8b24f73

Please sign in to comment.