-
Notifications
You must be signed in to change notification settings - Fork 26
Issue #17 solved #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zofiamilczarek
wants to merge
21
commits into
ptal:main
Choose a base branch
from
zofiamilczarek:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue #17 solved #52
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c9e9673
Spell class file created
5f165fc
Spell class: constructor added
d0e418c
Spell class now extends Action class.
3167f49
Spell class constructor updated.
56ed156
Spell constructor edited
8f94778
DoubleDamage spell file created
de2ed0f
Added accept method to DoubleDamage class & added visitDoubleDamage m…
5ede14e
Double damage edited
45bde9b
Added methods in Champion class in order to change Champion attribute…
cd5f943
Visitor method for double damage overriden in ApplyAction and a metho…
36def2d
Small update in Champion class
20522af
minor changes
7bd0857
merge resolved
6c33d0e
Merged with the latest version
8183a90
AI class for spell added
699cb03
Added tryDoubleDamageOnNexus to RandomAISpell class
0369208
Spells integrated with the AI (with some bugs)
cacc0f9
Updated Client class to test something
e4463f9
AI bugs fixed, the spells work now
405c1f1
Updated pom file
5bdab95
merge conflicts resolved
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package lol.client.ai; | ||
| package lol.client.ai; | ||
|
|
||
| import java.util.*; | ||
| import lol.game.*; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package lol.client.ai; | ||
|
|
||
| import java.util.*; | ||
| import lol.game.*; | ||
| import lol.game.action.*; | ||
|
|
||
| public class RandomAISpell extends RandomAITower { | ||
|
|
||
| public RandomAISpell(Arena arena, Battlefield battlefield) { | ||
| super(arena, battlefield); | ||
| } | ||
|
|
||
| public Turn turn() { | ||
| Turn turn = new Turn(); | ||
| //try to attack with a spell first | ||
| tryDoubleDamageOnNexus(turn); | ||
| // Try to attack the Nexus | ||
| tryAttackNexus(turn); | ||
|
|
||
| tryDoubleDamageOnTower(turn); | ||
| // Try to attack a Tower. | ||
| // Add a move action in case we could not attack the Nexus. | ||
| tryAttackTower(turn); | ||
| tryMove(turn); | ||
| return turn; | ||
| } | ||
|
|
||
| protected void tryDoubleDamageOnNexus(Turn turn) { | ||
| arena.teamOf(teamID).forEachChampion((champion, id) -> | ||
| battlefield.visitAdjacent(champion.x(), champion.y(), champion.attackRange(), new TileVisitor(){ | ||
| public void visitNexus(Nexus nexus) { | ||
| if(nexus.teamOfNexus() != teamID) { | ||
| turn.registerAction(new DoubleDamage(teamID, id, nexus.x(), nexus.y())); | ||
| } | ||
| } | ||
| })); | ||
| } | ||
|
|
||
| protected void tryDoubleDamageOnTower(Turn turn) { | ||
| arena.teamOf(teamID).forEachChampion((champion, id) -> | ||
| battlefield.visitAdjacent(champion.x(), champion.y(), champion.attackRange(), new TileVisitor(){ | ||
| public void visitTower(Tower tower) { | ||
| if(tower.teamOfTower() != teamID) { | ||
| turn.registerAction(new DoubleDamage(teamID, id, tower.x(), tower.y())); | ||
| } | ||
| } | ||
| })); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package lol.game.action; | ||
|
|
||
| import lol.game.*; | ||
| import java.io.Serializable; | ||
|
|
||
| public class DoubleDamage extends Spell implements Serializable { | ||
| protected int x; | ||
| protected int y; | ||
|
|
||
| public DoubleDamage(int teamID, int championID, int x, int y) { | ||
| super(teamID,championID); | ||
| this.x = x; | ||
| this.y = y; | ||
| } | ||
|
|
||
| public void accept(ActionVisitor visitor) { | ||
| visitor.visitDoubleDamage(teamID, championID, x, y); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package lol.game.action; | ||
|
|
||
| import lol.game.*; | ||
| import java.io.Serializable; | ||
|
|
||
| public abstract class Spell extends Action implements Serializable { | ||
| protected int championID; | ||
|
|
||
| public Spell(int teamID, int championID) { | ||
| super(teamID); | ||
| this.championID=championID; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a
private attack(Destructible d, int damage)method that is used by both attackEnhanced and attack (to avoid code duplication).