Merge remote-tracking branch 'refs/remotes/origin/master' into zocker-branch

pull/11/head
Zocker1999NET 9 years ago
commit e3786f626b

@ -0,0 +1,19 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Dice here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Dice extends Actor
{
/**
* Act - do whatever the Dice wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}

@ -0,0 +1,72 @@
import greenfoot.*;
import java.util.Arrays; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Dice_Offender here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Dice_Defender extends Dice
{
/**
* Act - do whatever the Dice_Offender wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int[] diceEyesDefender = new int[2];
public void act()
{
// Add your action code here.
}
/**
* Die Methode für das Würfeln mit bis zu drei Würfeln des Angreifers, es wird ein Array mit den drei Zahlen zurückgegeben, höchster Wert befindet sich immer an dritter Stelle.
* @param troupNumberDefender Anzahl der Truppen auf dem ausgewählten Feld
*/
public int[] dice_defender(int troupNumberDefender)
{
if(troupNumberDefender == 1)
{
diceEyesDefender[0] = (int) (Math.random() * 6 +1);
return diceEyesDefender;
}
if(troupNumberDefender >=2 )
{
diceEyesDefender[0] = (int) (Math.random() * 6 +1);
diceEyesDefender[1] = (int) (Math.random()* 6 +1);
System.out.println(diceEyesDefender[0]);
System.out.println(diceEyesDefender[1]);
return diceEyesDefender;
}
Arrays.sort(diceEyesDefender);
return diceEyesDefender;
}
public int[] max_defender(int troupNumberDefender)
{
if(troupNumberDefender == 1)
{
diceEyesDefender[0] = (int) (Math.random() * 2 +4);
return diceEyesDefender;
}
if(troupNumberDefender >=2 )
{
diceEyesDefender[0] = (int) (Math.random() * 2 +4);
diceEyesDefender[1] = (int) (Math.random()* 2 +4);
System.out.println(diceEyesDefender[0]);
System.out.println(diceEyesDefender[1]);
return diceEyesDefender;
}
Arrays.sort(diceEyesDefender);
return diceEyesDefender;
}
}

@ -0,0 +1,104 @@
import greenfoot.*;
import java.util.Arrays; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Dice_Offender here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Dice_Offender extends Dice
{
/**
* Act - do whatever the Dice_Offender wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int[] diceEyesOffender = new int[3];
public void act()
{
// Add your action code here.
}
/**
* Die Methode für das Würfeln mit bis zu drei Würfeln des Angreifers, es wird ein Array mit den drei Zahlen zurückgegeben, höchster Wert befindet sich immer an dritter Stelle.
* @param troupNumberOffender Anzahl der Truppen auf dem ausgewählten Feld
*/
public int[] dice_offender(int troupNumberOffender)
{
if(troupNumberOffender == 1)
{
System.out.println("Mit einer verbleibenden Truppe auff dem Feld kann man nicht angreifen!");
}
if(troupNumberOffender == 2)
{
diceEyesOffender[0] = (int) (Math.random()*6+1);
System.out.println(diceEyesOffender[0]);
return diceEyesOffender;
}
if(troupNumberOffender == 3)
{
diceEyesOffender[0] = (int) (Math.random() * 6 +1);
diceEyesOffender[1] = (int) (Math.random()* 6 +1);
System.out.println(diceEyesOffender[0]);
System.out.println(diceEyesOffender[1]);
return diceEyesOffender;
}
if(troupNumberOffender > 3)
{
diceEyesOffender[0] = (int) (Math.random() * 6 +1);
diceEyesOffender[1] = (int) (Math.random()* 6 +1);
diceEyesOffender[2] = (int) (Math.random()* 6 + 1);
System.out.println(diceEyesOffender[0]);
System.out.println(diceEyesOffender[1]);
System.out.println(diceEyesOffender[2]);
return diceEyesOffender;
}
Arrays.sort(diceEyesOffender);
return diceEyesOffender;
}
public int[] max_offender(int troupNumberOffender)
{
if(troupNumberOffender == 1)
{
System.out.println("Mit einer verbleibenden Truppe auff dem Feld kann man nicht angreifen!");
}
if(troupNumberOffender == 2)
{
diceEyesOffender[0] = (int) (Math.random()*2+5);
System.out.println(diceEyesOffender[0]);
return diceEyesOffender;
}
if(troupNumberOffender == 3)
{
diceEyesOffender[0] = (int) (Math.random() * 2 +5);
diceEyesOffender[1] = (int) (Math.random()* 2 +5);
System.out.println(diceEyesOffender[0]);
System.out.println(diceEyesOffender[1]);
return diceEyesOffender;
}
if(troupNumberOffender > 3)
{
diceEyesOffender[0] = (int) (Math.random() * 2 +5);
diceEyesOffender[1] = (int) (Math.random()* 2 +5);
diceEyesOffender[2] = (int) (Math.random()* 2 + 5);
System.out.println(diceEyesOffender[0]);
System.out.println(diceEyesOffender[1]);
System.out.println(diceEyesOffender[2]);
return diceEyesOffender;
}
Arrays.sort(diceEyesOffender);
return diceEyesOffender;
}
}

@ -27,9 +27,9 @@ public class GeneralMap extends World
* @param y Y-Ausdehnung
* @param p Kantenlänge der Felder in Pixeln
*/
super(1920, 1080, 1);
super(1600, 900, 1);
addObject(new Menue_Button(),100,38);
addObject(new Roll_Button(),100,1000);
addObject(new Roll_Button(),1814,1000);
addObject(new Roll_Button(),84,835);
addObject(new Roll_Button(),1513,835);
}
}

@ -6,6 +6,4 @@ Genutzt wird hierfür die Umgebung von [Greenfoot](http://www.greenfoot.org/over
[Link zum Architekturplan](https://github.com/HGE-IT-Course-2016/zweiundvierzig/blob/master/planung/architektur.md)
[Link zur GitHub Anleitung](https://sway.com/okMacr2VwpaJETmu)
**Weitere Informationen hier werden folgen.**

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Loading…
Cancel
Save