Shadow of the Lord vs. Dark-edged sword fiend
Fight
Who is the winner?
Package com.bingbing.game;
public class Hero {
private int hp;//Hero's health value
private int defence;//Random defense bonus per turn
private int attac;//Random damage bonus per turn
Private String name;//Hero name
Construction method
Public Hero (int hp, int defence, int attac, String name) {
THIS.HP = HP;
This.defence = defence;
This.attac = Attac;
THIS.name = name;
}
Attack method
public void Att (Hero Hero) {
THIS.ATTAC = (int) (Math.random () * This.attac) + 40;
if (this.attac<60) {
System.out.println (THIS.name + "said: Only play" +this.attac+ "point injury, no way to fight wild always come to gank equipment is too poor");
}
System.out.println (this.name+ "chop down a knife," + "Damage:" +this.attac);
Hero.defend (this);
}
Defense methods
public void Defend (Hero Hero) {
this.defence = (int) (Math.random () * this.defence) + 40;
The current defensive force of the System.out.println (this.name+) is "+this.defence";
int temp = hero.attac-this.defence;
if (temp>55) {
SYSTEM.OUT.PRINTLN (this.name+ "said: This" +hero.name + "hit really hurt, I want to hang machine! ");
}
if (temp<=0) {
Temp=0;
System.out.println (this.name+ "escaped from the" +hero.name+ "attack by walking);
}
if ((THIS.HP-= temp) <= 0) {
THIS.HP = 0;
}
System.out.println (this.name+ "Loss of blood" +temp+ "residual blood volume" +this.hp+ "\ n");
}
Judging whether a hero is a martyr
public Boolean isAlive () {
if (HP = = 0) {
System.out.println (THIS.name + "said:" Mlgb died really lost, forgot to turn the Flash ");
return false;
}
return true;
}
}
///////////////////////////////////////////////////////////////////////////////////////
Package com.bingbing.game;
public class PlayGame {
public static void Main (string[] args) {
Hero hero1= New Hero (3000, 200, 150, "Dark Sword Demon");
Hero hero2= New Hero (2500, 150, 230, "The Master of Shadow Flow");
while (Hero1.isalive () &&hero2.isalive ()) {
Hero1.att (HERO2);
if (hero2.isalive ()) {
Hero2.att (Hero1);
}else {
Prevent duplicate judgment Hero2 caused two printing "the Lord said:" Mlgb died really lost, forgot to turn over the flash. "
Because if the condition is not return,while, it will be executed again.
Return
}
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
Dark-edged sword-fiend cuts a knife, damage: 90
The current defense force of the Shadow stream is 185.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow stream of the Lord cut a knife, the damage is: 200
The current defensive force of the dark-edged sword is 108.
Dark-edged Sword Demon said: This shadow flow of the Lord hit really hurt, I want to hang machine!
Dark-blooded sword demon blood loss 92 remaining blood volume 2908
Dark-edged sword-fiend cuts a knife, damage: 107
The current defense force of the Shadow stream is 185.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow flow of the Lord said: only 41 damage, no way to play wild always come gank equipment is too poor
Shadow stream of the Lord cut a knife, the damage is: 41
The current defensive force of the dark-edged sword is 62.
The dark-edged sword demon escaped an attack from the Shadow Lord by walking.
Dark-blooded sword demon blood loss 0 remaining blood volume 2908
Dark-edged sword-fiend cuts a knife, damage: 105
The current defense force of the Shadow stream is 146.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow stream of the Lord cut a knife, the damage is: 77
The current defensive force of the dark-edged sword is 72.
Dark-blooded sword demon blood loss 5 remaining blood volume 2903
Dark-edged sword-fiend cuts a knife, damage: 61
The current defense force of the shadow stream is 108.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow flow of the Lord said: only 41 damage, no way to play wild always come gank equipment is too poor
Shadow stream of the Lord cut a knife, the damage is: 41
The current defensive force of the dark-edged sword is 50.
The dark-edged sword demon escaped an attack from the Shadow Lord by walking.
Dark-blooded sword demon blood loss 0 remaining blood volume 2903
Dark-edged sword-fiend cuts a knife, damage: 91
The current defense force of the Shadow stream is 112.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow stream of the Lord cut a knife, the damage is: 75
The current defensive force of the dark-edged sword is 57.
Dark-blooded sword demon blood loss 18 remaining blood volume 2885
Dark-edged sword-fiend cuts a knife, damage: 76
The current defense force of the Shadow stream is 81.
The Lord of the Shadows escaped from an attack by a dark-American sword.
Loss of the primary blood volume of the shadow stream 0 of the remaining amount of blood 2500
Shadow flow of the Lord said: only 49 damage, no way to play wild always come gank equipment is too poor
Shadow stream of the Lord cut a knife, the damage is: 49
The current defensive force of the dark-edged sword is 74.
The dark-edged sword demon escaped an attack from the Shadow Lord by walking.
Dark-blooded sword demon blood loss 0 remaining blood volume 2885
Dark-edged sword-fiend cuts a knife, damage: 79
The current defense force of the shadow stream is 48.
Loss of the primary blood volume of the shadow stream 31 of the remaining amount of blood 2469
Shadow stream of the Lord cut a knife, the damage is: 79
The current defensive force of the dark-edged sword is 52.
Dark-blooded sword demon blood loss 27 remaining blood volume 2858
Dark-edged sword-fiend cuts a knife, damage: 102
The current defense force of the shadow stream is 56.
Loss of the primary blood volume of the shadow stream 46 of the remaining amount of blood 2423
Shadow flow of the Lord said: only 48 damage, no way to play wild always come gank equipment is too poor
Shadow stream of the Lord cut a knife, the damage is: 48
The current defensive force of the dark-edged sword is 50.
The dark-edged sword demon escaped an attack from the Shadow Lord by walking.
Dark-blooded sword demon blood loss 0 remaining blood volume 2858
...//Omit part of the battle process, it is a fierce protracted war
Shadow flow of the Lord said: only 52 damage, no way to play wild always come gank equipment is too poor
Shadow stream of the Lord cut a knife, the damage is: 52
The current defensive force of the dark-edged sword is 95.
The dark-edged sword demon escaped an attack from the Shadow Lord by walking.
Dark-blooded sword demon blood loss 0 remaining blood volume 751
Dark-edged sword-fiend cuts a knife, damage: 150
The current defense force of the Shadow stream is 51.
Shadow flow of the Lord said: "This dark-born sword demon hit really hurts, I want to hang up the machine!"
Loss of the primary blood volume of the shadow stream 99 of the remaining amount of blood 0
Shadow flow of the Lord said: Mlgb death really lost, forgot to turn over the flash
A little game--League of Legends