Skip to content
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

AI Attack & getSpellAbilityToPlay Timeout #6577

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e2c37d1
AI Attack Timeout
kevlahnota Nov 14, 2024
8dbb648
add user setting for AI Timeout
kevlahnota Nov 14, 2024
66c08ab
try to fix unsupportedoperation
kevlahnota Nov 14, 2024
37eed29
try this multimap for manapool
kevlahnota Nov 15, 2024
a988261
check for stack only
kevlahnota Nov 15, 2024
8a1d25e
fix failing test
kevlahnota Nov 15, 2024
fc85623
better to use a linkedqueue
kevlahnota Nov 15, 2024
4936fd3
remove comment, seems it works fine. need to test on android.
kevlahnota Nov 15, 2024
a094149
remove redundant check for can cast timing
kevlahnota Nov 15, 2024
b9a56f0
revert multimap, needs better implementation for this
kevlahnota Nov 15, 2024
d9c4c81
Merge branch 'master' into AI_ATTACK_TIMEOUT
kevlahnota Nov 15, 2024
f52b7ab
create ConcurrentMultiMap, remove unused map
kevlahnota Nov 15, 2024
5c46048
removed unused import
kevlahnota Nov 15, 2024
7c35968
try to fix ConcurrentModificationException on FCollection -> addAll
kevlahnota Nov 15, 2024
548f97a
dumb check for AI
kevlahnota Nov 15, 2024
acfde12
Merge branch 'master' into AI_ATTACK_TIMEOUT
kevlahnota Nov 16, 2024
0247acb
Merge branch 'master' into AI_ATTACK_TIMEOUT
kevlahnota Nov 16, 2024
cb64567
Merge branch 'master' into AI_ATTACK_TIMEOUT
kevlahnota Nov 16, 2024
54266e8
Merge branch 'master' into AI_ATTACK_TIMEOUT
kevlahnota Nov 16, 2024
1261332
Update PlayEffect.java
kevlahnota Nov 16, 2024
f72ab6f
use removeall
kevlahnota Nov 16, 2024
6c847e0
refactor AiCardMemory
kevlahnota Nov 16, 2024
f6d2d42
use anymatch
kevlahnota Nov 16, 2024
5dc84a6
remove threadsafeIterable
kevlahnota Nov 17, 2024
619130b
remove unused import
kevlahnota Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions forge-ai/src/main/java/forge/ai/AiCardMemory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package forge.ai;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import forge.game.card.Card;
import forge.game.player.Player;
Expand Down Expand Up @@ -79,21 +79,21 @@ public enum MemorySet {
private final Set<Card> memRevealedCards;

public AiCardMemory() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@tool4ever @kevlahnota might it be cleaner if we change the structure into this?

Map<MemorySet, Set<Card>>, and have the whole logic inside?
Then we don't need extra properties for each MemorySet-Type

this.memMandatoryAttackers = new HashSet<>();
this.memHeldManaSources = new HashSet<>();
this.memHeldManaSourcesForCombat = new HashSet<>();
this.memHeldManaSourcesForEnemyCombat = new HashSet<>();
this.memAttachedThisTurn = new HashSet<>();
this.memAnimatedThisTurn = new HashSet<>();
this.memBouncedThisTurn = new HashSet<>();
this.memActivatedThisTurn = new HashSet<>();
this.memTrickAttackers = new HashSet<>();
this.memChosenFogEffect = new HashSet<>();
this.memMarkedToAvoidReentry = new HashSet<>();
this.memHeldManaSourcesForNextSpell = new HashSet<>();
this.memPaysTapCost = new HashSet<>();
this.memPaysSacCost = new HashSet<>();
this.memRevealedCards = new HashSet<>();
this.memMandatoryAttackers = ConcurrentHashMap.newKeySet();
this.memHeldManaSources = ConcurrentHashMap.newKeySet();
this.memHeldManaSourcesForCombat = ConcurrentHashMap.newKeySet();
this.memHeldManaSourcesForEnemyCombat = ConcurrentHashMap.newKeySet();
this.memAttachedThisTurn = ConcurrentHashMap.newKeySet();
this.memAnimatedThisTurn = ConcurrentHashMap.newKeySet();
this.memBouncedThisTurn = ConcurrentHashMap.newKeySet();
this.memActivatedThisTurn = ConcurrentHashMap.newKeySet();
this.memTrickAttackers = ConcurrentHashMap.newKeySet();
this.memChosenFogEffect = ConcurrentHashMap.newKeySet();
this.memMarkedToAvoidReentry = ConcurrentHashMap.newKeySet();
this.memHeldManaSourcesForNextSpell = ConcurrentHashMap.newKeySet();
this.memPaysTapCost = ConcurrentHashMap.newKeySet();
this.memPaysSacCost = ConcurrentHashMap.newKeySet();
this.memRevealedCards = ConcurrentHashMap.newKeySet();
}

private Set<Card> getMemorySet(MemorySet set) {
Expand Down
Loading