|
@@ -0,0 +1,35 @@
|
|
|
|
+package com.sf.day09.homework.impl;
|
|
|
|
+
|
|
|
|
+import com.sf.day09.homework.FightAble;
|
|
|
|
+
|
|
|
|
+import java.util.Scanner;
|
|
|
|
+
|
|
|
|
+public class Player {
|
|
|
|
+ static FightAble select(String str){
|
|
|
|
+ if(str.equals("法力角色")){
|
|
|
|
+ FightAble fightAble = new Mage();
|
|
|
|
+ fightAble.specialFight();
|
|
|
|
+ fightAble.commonFight();
|
|
|
|
+ return fightAble;
|
|
|
|
+ }else if (str.equals("武力角色")){
|
|
|
|
+ FightAble fightAble = new Soldier();
|
|
|
|
+ fightAble.specialFight();
|
|
|
|
+ fightAble.commonFight();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ Scanner scanner = new Scanner(System.in);
|
|
|
|
+ while (true){
|
|
|
|
+ System.out.println("选择:");
|
|
|
|
+ String next = scanner.next();
|
|
|
|
+ if(next.equals("exit")){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ FightAble select = select(next);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|