Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Actor(){
- let tp=0
- constructor(name, hp, dex) {
- this.name = name;
- this.hp = hp;
- this.dex = dex;
- }
- Class Battle(){
- constructor(attackers, defenders) {
- this.attackers = attackers;
- this.defenders = defenders;
- }
- function/GetActor(){
- const/actors = [this.attackers, this.defenders]
- while(actors.lenght>1){
- if(a.tp===10) console.log(`now is ${a} turn`); a.tp=0; break //tutaj
- a.tp+=1+a.dex
- }
- }
- }
- let User1 = Actor("Hero", 1, 4) //Jest szybszy
- let Enemy = Actor("Slug", 1, 1)
- let/attTeam = [User1]
- let/defTeam = [Enemy]
- let myBattle = Battle(attTeam, defTeam)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement