41 lines
868 B
Java
41 lines
868 B
Java
|
import java.awt.*;
|
||
|
import javax.swing.*;
|
||
|
import java.awt.event.*;
|
||
|
import java.util.*;
|
||
|
|
||
|
public class CaseBonus extends Case {
|
||
|
|
||
|
public CaseBonus(int x, int y, String type){
|
||
|
super(x, y, type);
|
||
|
}
|
||
|
|
||
|
public CaseBonus newRandomCaseBonus(int x, int y){
|
||
|
Random rand = new Random();
|
||
|
int aleatoire = rand.nextInt();
|
||
|
if(aleatoire < 0){
|
||
|
aleatoire = -aleatoire;
|
||
|
}
|
||
|
if (aleatoire % 100 < 25){
|
||
|
aleatoire = rand.nextInt();
|
||
|
if(aleatoire < 0){
|
||
|
aleatoire = -aleatoire;
|
||
|
}
|
||
|
return new Potion(aleatoire % 40 + 1, x, y);
|
||
|
} else {
|
||
|
if (aleatoire % 100 > 64){
|
||
|
aleatoire = rand.nextInt();
|
||
|
if(aleatoire < 0){
|
||
|
aleatoire = -aleatoire;
|
||
|
}
|
||
|
return new Arme(aleatoire % 50 + 1, x, y);
|
||
|
} else {
|
||
|
aleatoire = rand.nextInt();
|
||
|
if(aleatoire < 0){
|
||
|
aleatoire = -aleatoire;
|
||
|
}
|
||
|
return new Or(aleatoire % 100 + 1, x, y);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|