mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-03 20:59:17 +00:00 
			
		
		
		
	fix random
This commit is contained in:
		@@ -45,6 +45,7 @@ public class Battle {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void action(int answer){
 | 
					    public void action(int answer){
 | 
				
			||||||
 | 
					        textEnemy.randomAnswer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       //the player is at the last question, the finish text must be displayed
 | 
					       //the player is at the last question, the finish text must be displayed
 | 
				
			||||||
        if(getLineSpeech() == 4){
 | 
					        if(getLineSpeech() == 4){
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,8 @@ public class TextEnemy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private Vector<int[]> currentData;
 | 
					    private Vector<int[]> currentData;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    int[] currentRandom = new int[5];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public TextEnemy(Enemy e){
 | 
					    public TextEnemy(Enemy e){
 | 
				
			||||||
        //generate the vector of fight
 | 
					        //generate the vector of fight
 | 
				
			||||||
        fightData = new FightData(e.getBranch());
 | 
					        fightData = new FightData(e.getBranch());
 | 
				
			||||||
@@ -36,9 +38,18 @@ public class TextEnemy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
					        orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        randomAnswer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void randomAnswer(){
 | 
				
			||||||
        //generate a random array to determine the order of the answer
 | 
					        //generate a random array to determine the order of the answer
 | 
				
			||||||
        orderAnswer = randomGenerate(0, 3, 4);
 | 
					        orderAnswer = randomGenerate(0, 3, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //save the order of answer and attack
 | 
				
			||||||
 | 
					        for(int k=1;k<5;k++){
 | 
				
			||||||
 | 
					            currentRandom[k] = orderAnswer[k-1];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static int[] randomGenerate( int min, int max, int nbrRandom){
 | 
					    public static int[] randomGenerate( int min, int max, int nbrRandom){
 | 
				
			||||||
@@ -88,17 +99,8 @@ public class TextEnemy {
 | 
				
			|||||||
        //orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
					        //orderAttack = randomGenerate(0, fightData.nbr_line-1, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for(int j=0; j<4;j++){
 | 
					        for(int j=0; j<4;j++){
 | 
				
			||||||
            int[] currentRandom = new int[5];
 | 
					 | 
				
			||||||
            currentRandom[0] = orderAttack[j];
 | 
					            currentRandom[0] = orderAttack[j];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //generate a random array to determine the order of the answer
 | 
					 | 
				
			||||||
            //orderAnswer = randomGenerate(0, 3, 4);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //save the order of answer and attack
 | 
					 | 
				
			||||||
            for(int k=1;k<5;k++){
 | 
					 | 
				
			||||||
                currentRandom[k] = orderAnswer[k-1];
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //Format the line
 | 
					            //Format the line
 | 
				
			||||||
            String[] row = new String[4];
 | 
					            String[] row = new String[4];
 | 
				
			||||||
            row[0] = row[1] = row[2] = row[3] = "    ";
 | 
					            row[0] = row[1] = row[2] = row[3] = "    ";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user