Skip to content

Champion revive, attack and death.#31

Open
irreal99 wants to merge 2 commits intoptal:mainfrom
irreal99:main
Open

Champion revive, attack and death.#31
irreal99 wants to merge 2 commits intoptal:mainfrom
irreal99:main

Conversation

@irreal99
Copy link

Added the ability to revive fallen champions after 3 turns. The number of turns can be changed. The position where the champion is being revived is random, but can be changed later by modifying two parameters. Reviving is done before any other action.

Added the ability to attack enemy champions. This was needed to be able to revive the champions, because if no champions die no champions can be revived. Attacking other champions is done before attacking the nexus or moving if possible.

The modifications also allow to remove dead corpses from the field as soon as they die. This was needed in order not to overload the battlefield with useless corpses.

Copy link
Owner

@ptal ptal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Good work!

I made some comments below that should be addressed before merging. You can also comment my comments (that's a discussion on the code).

// First check if a champion needs to be revived.
arena.teamOf(teamID).forEachChampion((champion, id) -> {
if (!champion.isAlive()){
turn.registerAction(new Revive(teamID, id, (int) (Math.random()*9), (int) (Math.random()*9)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be automatic on the server side, and the champion should spawn next to its nexus.
Also, because it is done on the client side, the client can choose to spawn just next to the opponent nexus.
Why do we need a revive action? Doesn't a Spawn action would be enough? (It would also allows to reuse most of the mechanics of a spawn action).

}

public void removeChampion(Destructible d, int x, int y) {
if (d instanceof Champion && !d.isAlive()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could generalize to removeDestructible since anything destructible (including nexus) should be remove when it's dead. That would also remove the need for an instanceof.

return deathTimer==3;
}

public void resetTimer() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to override revive and reset the timer there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants