ProgLab2/pass
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package main;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
import pokemons.*;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args){
|
||||
Battle b = new Battle();
|
||||
Pokemon p1 = new Dialga("Dialga", 1);
|
||||
Pokemon p2 = new Cranidos("Cranidos", 1);
|
||||
Pokemon p3 = new Rampardos("Rampardos", 1);
|
||||
Pokemon p4 = new NidoranF("NidoranF", 1);
|
||||
Pokemon p5 = new Nidorina("Nidorina", 1);
|
||||
Pokemon p6 = new Nidoqueen("Nidoqueen", 1);
|
||||
b.addAlly(p1);
|
||||
b.addAlly(p2);
|
||||
b.addAlly(p3);
|
||||
b.addFoe(p4);
|
||||
b.addFoe(p5);
|
||||
b.addFoe(p6);
|
||||
b.go();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class AuraSphere extends SpecialMove {
|
||||
public AuraSphere() {
|
||||
super(Type.FIGHTING, 80, 1);
|
||||
}
|
||||
|
||||
@Override protected boolean checkAccuracy(Pokemon att, Pokemon def) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "выпускает шар ауры";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Confide extends StatusMove {
|
||||
public Confide() {
|
||||
super(Type.NORMAL, 0, 1);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
Effect e = new Effect().stat(Stat.SPECIAL_ATTACK, -1);
|
||||
p.addEffect(e);
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "отвлекает противника";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class DoubleTeam extends StatusMove {
|
||||
public DoubleTeam() {
|
||||
super(Type.NORMAL, 0, 1);
|
||||
}
|
||||
|
||||
@Override protected void applySelfEffects(Pokemon p) {
|
||||
Effect e = new Effect().stat(Stat.EVASION, 1);
|
||||
p.addEffect(e);
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "быстро перемещается";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Facade extends PhysicalMove {
|
||||
public Facade() {
|
||||
super(Type.NORMAL, 70, 1);
|
||||
}
|
||||
|
||||
@Override protected void applySelfEffects(Pokemon p) {
|
||||
if (p.getCondition() == Status.PARALYZE ||
|
||||
p.getCondition() == Status.BURN ||
|
||||
p.getCondition() == Status.POISON) {
|
||||
Effect e = new Effect().stat(Stat.ATTACK, 1);
|
||||
p.addEffect(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "показывает силу";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class FocusBlast extends SpecialMove {
|
||||
public FocusBlast() {
|
||||
super(Type.FIGHTING, 120, 0.7);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
if (Math.random() < 0.1) {
|
||||
Effect e = new Effect().stat(Stat.SPECIAL_DEFENSE, -1);
|
||||
p.addEffect(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "ментально атакует противника";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Growl extends StatusMove {
|
||||
public Growl() {
|
||||
super(Type.NORMAL, 0, 1);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
p.addEffect(new Effect().stat(Stat.ATTACK, -1));
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "рычит на противника";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Headbutt extends PhysicalMove {
|
||||
|
||||
public Headbutt() {
|
||||
super(Type.NORMAL, 70, 1);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
if (Math.random() < 0.3) {
|
||||
Effect.flinch(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "ударяет противника головой";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Rest extends StatusMove {
|
||||
public Rest() {
|
||||
super(Type.PSYCHIC, 0, 1);
|
||||
}
|
||||
|
||||
@Override protected void applySelfEffects(Pokemon p) {
|
||||
p.addEffect(new Effect().stat(Stat.HP, (int) -(12 - p.getHP())).turns(1));
|
||||
p.addEffect(new Effect().attack(0).turns(2));
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "решает отдохнуть";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class RockSlide extends PhysicalMove {
|
||||
public RockSlide() {
|
||||
super(Type.ROCK, 75, 0.9);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
if (Math.random() < 0.3) {
|
||||
Effect.flinch(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "скидывает булыжник";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class RockTomb extends PhysicalMove {
|
||||
public RockTomb() {
|
||||
super(Type.ROCK, 60, 0.95);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
Effect e = new Effect().stat(Stat.SPEED, -1);
|
||||
p.addEffect(e);
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "запускает камни в противника";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Thunder extends SpecialMove {
|
||||
public Thunder() {
|
||||
super(Type.ELECTRIC, 110, 0.7);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
if (Math.random() < 0.3) {
|
||||
Effect.paralyze(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "вызывает Грозу";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package moves;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
|
||||
public final class Thunderbolt extends SpecialMove {
|
||||
public Thunderbolt() {
|
||||
super(Type.ELECTRIC, 90, 1);
|
||||
}
|
||||
|
||||
@Override protected void applyOppEffects(Pokemon p) {
|
||||
if (Math.random() < 0.1) {
|
||||
Effect.paralyze(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected String describe() {
|
||||
return "вызывает молнию";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pokemons;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
import moves.*;
|
||||
|
||||
public class Cranidos extends Pokemon {
|
||||
public Cranidos(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(12, 8, 6, 6, 6, 6);
|
||||
setType(Type.ROCK);
|
||||
setMove(new Facade(), new Headbutt(), new RockTomb());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pokemons;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
import moves.*;
|
||||
|
||||
public final class Dialga extends Pokemon {
|
||||
public Dialga(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(13, 8, 8, 8, 7, 7);
|
||||
setType(Type.STEEL, Type.DRAGON);
|
||||
setMove(new Confide(), new Thunder(), new DoubleTeam(), new AuraSphere());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package pokemons;
|
||||
|
||||
import moves.*;
|
||||
|
||||
public final class Nidoqueen extends Nidorina {
|
||||
public Nidoqueen(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(13, 7, 7, 7, 7, 7);
|
||||
addMove(new RockSlide());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pokemons;
|
||||
|
||||
import ru.ifmo.se.pokemon.*;
|
||||
import moves.*;
|
||||
|
||||
public class NidoranF extends Pokemon {
|
||||
public NidoranF(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(12, 6, 6, 6, 6, 6);
|
||||
setType(Type.POISON);
|
||||
setMove(new Thunderbolt(), new Rest());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package pokemons;
|
||||
|
||||
import moves.*;
|
||||
|
||||
public class Nidorina extends NidoranF {
|
||||
public Nidorina(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(13, 6, 6, 6, 6, 6);
|
||||
addMove(new Growl());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package pokemons;
|
||||
|
||||
import moves.*;
|
||||
|
||||
public final class Rampardos extends Cranidos {
|
||||
public Rampardos(String name, int level) {
|
||||
super(name, level);
|
||||
setStats(13, 8, 6, 6, 6, 6);
|
||||
addMove(new FocusBlast());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user