Beispiel #1
0
 /**
  * Helper method makes simple scrollable panel full of possible responses.
  *
  * @param c Character accused
  * @param w Weapon accused
  * @param r Room accused
  * @return scroll panel of buttons
  */
 private JScrollPane cardsPanel(Character c, Weapon w, Room r) {
   JPanel panel = new JPanel(new FlowLayout()); // perhaps boxlayout along x
   JScrollPane pane =
       new JScrollPane(
           panel,
           JScrollPane.VERTICAL_SCROLLBAR_NEVER,
           JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   for (Card crd : player.getCards()) {
     if (crd.toString().equals(c.getName())
         || crd.toString().equals(w.getName())
         || crd.toString().equals(r.toString())) {
       refutable = true;
       JButton l = new JButton(new ImageIcon(crd.getCardImg()));
       final Card refW = crd;
       l.addActionListener(
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent arg0) {
               refutedWith = refW;
             }
           });
       l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
       l.setBorder(new EmptyBorder(10, 10, 10, 10));
       panel.add(l);
     }
   }
   return pane;
 }
Beispiel #2
0
 @Override
 public void hit(Player source, Character target) {
   switch (e) {
     case FireDamage:
       target.takeDamage(strength, DamageType.Fire);
       break;
     case StealHealth:;
       break;
     case StealMana:
       break;
     default:
       break;
   }
 }