Skip to content

Commit

Permalink
flip highest and lowest attack/defense monsters (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSwerik authored Aug 7, 2024
1 parent 5eb4766 commit d409521
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Game/AI/CardContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,32 @@ public static ClientCard GetHighestAttackMonster(this IEnumerable<ClientCard> ca
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderBy(card => card.Attack).FirstOrDefault();
.OrderByDescending(card => card.Attack)
.FirstOrDefault();
}

public static ClientCard GetHighestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderBy(card => card.Defense).FirstOrDefault();
.OrderByDescending(card => card.Defense)
.FirstOrDefault();
}

public static ClientCard GetLowestAttackMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Attack).FirstOrDefault();
.OrderBy(card => card.Attack)
.FirstOrDefault();
}

public static ClientCard GetLowestDefenseMonster(this IEnumerable<ClientCard> cards, bool canBeTarget = false)
{
return cards
.Where(card => card?.Data != null && card.HasType(CardType.Monster) && card.IsFaceup() && !(canBeTarget && card.IsShouldNotBeTarget()))
.OrderByDescending(card => card.Defense).FirstOrDefault();
.OrderBy(card => card.Defense)
.FirstOrDefault();
}

public static bool ContainsMonsterWithLevel(this IEnumerable<ClientCard> cards, int level)
Expand Down

0 comments on commit d409521

Please sign in to comment.