이벤트 [해축백일장] FiveBigLeagues.ts

class Team {

    public name: string;

    public city: string;

    public point: number;

    public manager: string;

    public players: string[];

    public tactics: 'normal' | 'experimental';

 

    constructor(name: string, city: string) {

        this.name = name;

        this.city = city;

        this.point = 0;

        this.manager = '';

        this.players = [];

        this.tactics = 'normal';

    }

}

 

abstract class League {

    public fixture: Team[];

    public numberOfTeams: number;

 

    constructor(teamList: Team[]) {

        this.fixture = teamList;

        this.numberOfTeams = teamList.length;

    }

 

    protected rank() {

        this.fixture.sort((a, b) => b.point - a.point);

    }

 

    public match(homeTeam: Team, awayTeam: Team) {

        const result = Math.floor(Math.random() * 3);

 

        if (result == 0) {

            homeTeam.point += 3;

        } else if (result == 1) {

            awayTeam.point += 3;

        } else {

            homeTeam.point += 1;

            awayTeam.point += 1;

        }

 

        this.rank();

    }

 

    abstract finalRound(): void;

}

 

class PremierLeague extends League {

    finalRound() {

        if (this.fixture[0].manager == 'Pep Guardiola' && this.fixture[0].tactics != 'experimental')

            console.log('Treble!');

    }

}

 

class LaLiga extends League {

    finalRound() {

        if ((this.fixture[0].name == 'Real Madrid' || 'Barcelona')

        || (this.fixture[0].name == 'Atletico Madrid' && this.fixture[0].tactics == 'experimental')) {

            console.log(`${this.fixture[0].name} is the Champion!`);

        } else { throw Error('Not LaLiga!'); }

    }

}

 

class SerieA extends League {

    finalRound() {

        const minjae = this.fixture[0].players.findIndex(player => player == 'Minjae Kim')

        if (minjae != -1) this.fixture[0].players.splice(minjae, 1);

    }

}

 

class Bundesliga extends League {

    finalRound() {

        if (this.fixture[0].name != 'Bayern Munich') {

            console.log('Assist by Jaesung Lee!');

            this.fixture[0].point -= 2;

            this.rank();

        }

    }

}

 

class LigueUn extends League {

    finalRound() {

        if (this.fixture[0].manager == 'Christophe Galtier') {

            console.log('Arrested!');

            this.fixture[0].manager = 'Luis Enrique';

        }

    }

}

댓글 3

리눅스 작성자 2023.07.07. 15:14
 뉴저지
웃겨야 정상인데
댓글
권한이 없습니다. 로그인

신고

"님의 댓글"

이 댓글을 신고 하시겠습니까?

삭제

"님의 댓글"

이 댓글을 삭제하시겠습니까?

분류 제목 글쓴이 날짜 조회 수
츄또공지 해외축구갤러리 츄르토토 규칙+츄사장 명단 3 Giallorossi 108 9
이벤트 제 9회 해축백일장 개최!(~9/1 23:59) 7 Giallorossi 183 20
공지 휴식기 각팀별 국가대표팀 차출자 명단 4 Giallorossi 268 12
잡담 개편까지의 계획 짧게 Giallorossi 359 22
잡담 7대1드립 현시점부터 밴합니다 10 천사시체 508 38
공지 공지. 6 강미나 2917 22
공지 FLAYUS 해외축구갤러리 공지사항 20200126 1차 개정판 41 강미나 8673 56
인기 남문은 현 잉글랜드의 창의적인 멤버들을 완벽하게 사용하기엔 능력이 안 닿는듯 프리드 36 5
인기 그런 의미에서 비록 리그와 국대라는 차이점이 있지만 창의성을 적절하게 살리면서 큰 흐름에선 해줘하되 언밸런스하지 않은(?) 프리드 20 4
인기 생각보다 더 유서깊은 기쁨에 돌아버린 트윗질 6 Giallorossi 54 4
이벤트
이미지
진짜재능박한결 41 3
이벤트
이미지
마꾸잉 133 19
이벤트
기본
추꾸 33 3
이벤트인증
이미지
A.C.Milan 14 1
이벤트
이미지
사나 25 5
이벤트인증
기본
Ortega 13 1
이벤트인증
이미지
SilverWolf 10 1
이벤트인증
이미지
시오츠카모에카 15 1
이벤트인증
이미지
앵귀리지 10 2
이벤트인증
이미지
rowletter 10 1
이벤트
이미지
뉴모1 48 6
이벤트인증
기본
장나영 22 1
이벤트
기본
Giallorossi 183 20
이벤트인증
이미지
시너 7 2
이벤트인증
이미지
항히스타민제 22 2
이벤트
기본
추꾸 54 16
이벤트인증
기본
토고 135 16
이벤트
기본
Muniain 68 13
이벤트인증
이미지
강미나 20 3
이벤트
이미지
귀여운중년임선남 68 4