class game {
base: number[] = new Array();
point: number;
out: number;
card: string[] = new Array();
bat(): void {
var n1: number;
var n2: number;
n1 = 10*Math.random();
n2 = Math.floor(n1) + 1;
if (this.card[n2] == "one") this.one();
if (this.card[n2] == "two") this.two();
if (this.card[n2] == "three") this.three();
if (this.card[n2] == "four") this.four();
if (this.card[n2] == "goro") this.goro();
if (this.card[n2] == "fly") this.fly();
if (this.card[n2] == "swing") this.swing();
if (this.card[n2] == "ball") this.ball();
}
ball(): void {
this.ball[1] = this.ball[1] + 1;
if (this.base[1] == 2) this.ball[2] = this.ball[2] + 1;
if (this.base[2] == 2) this.ball[3] = this.ball[3] + 1;
if (this.base[3] == 2) this.point=this.point+1;
if (this.base[3] == 2) this.base[3] = 1;
if (this.base[2] == 2) this.base[2] = 1;
if (this.base[1] == 2) this.base[1] = 1;
}
goro(): void {
if (this.base[3] == 1) this.point = this.point + 1;
if (this.base[3] == 1) this.base[3] = 0;
if (this.base[2] == 1) this.base[3] = 1;
if (this.base[2] == 1) this.base[2] = 0;
if (this.base[1] == 1) this.base[2] = 1;
this.base[1] = 0;
this.out = this.out + 1;
}
fly(): void {
this.out = this.out + 1;
}
swing(): void {
this.out = this.out + 1;
}
one(): void {
if (this.base[3] == 1) this.point = this.point+1;
if (this.base[3] == 1) this.base[3] = 0;
if (this.base[2] == 1) this.base[3] = 1;
if (this.base[2] == 1) this.base[2] = 0;
if (this.base[1] == 1) this.base[2] = 1;
this.base[1] = 1;
}
two(): void {
if (this.base[3] == 1) this.point = this.point + 1;
if (this.base[3] == 1) this.base[3] = 0;
if (this.base[2] == 1) this.point = this.point + 1;
if (this.base[2] == 1) this.base[2] = 0;
if (this.base[1] == 1) this.base[3] = 1;
if (this.base[1] == 1) this.base[1] = 0;
this.base[2] = 1;
}
three(): void {
if (this.base[3] == 1) this.point = this.point + 1;
if (this.base[3] == 1) this.base[3] = 0;
if (this.base[2] == 1) this.point = this.point + 1;
if (this.base[2] == 1) this.base[2] = 0;
if (this.base[1] == 1) this.point = this.point + 1;
if (this.base[1] == 1) this.base[1] = 0;
this.base[3] = 1;
}
four(): void {
if (this.base[3] == 1) this.point = this.point + 1;
if (this.base[3] == 1) this.base[3] = 0;
if (this.base[2] == 1) this.point = this.point + 1;
if (this.base[2] == 1) this.base[2] = 0;
if (this.base[1] == 1) this.point = this.point + 1;
if (this.base[1] == 1) this.base[1] = 0;
this.point = this.point + 1;
}
}
最終更新:2015年07月01日 15:32