Skip to content

Commit

Permalink
zzre: Fix GetFirstAttackSpell
Browse files Browse the repository at this point in the history
  • Loading branch information
Helco committed Oct 10, 2023
1 parent 80e5626 commit 68c7f8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zzre/game/StdSpellId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ private static bool IsSpellCompatible(SpellRow spell, zzio.ZZClass zzClass, uint
{
var price =
(spell.PriceA > 0 ? 1 : 0) +
(spell.PriceA > 1 ? 1 : 0) +
(spell.PriceA > 1 ? 1 : 0);
(spell.PriceB > 1 ? 1 : 0) +
(spell.PriceC > 1 ? 1 : 0);
var maxPrice = GetMaxPriceFor(level);
var maxRelevantPrice = spell.Type == 0 ? maxPrice.attack : maxPrice.support;
return spell.PriceA == (byte)zzClass && price <= maxRelevantPrice;
Expand All @@ -42,7 +42,7 @@ private static bool IsSpellCompatible(SpellRow spell, zzio.ZZClass zzClass, uint
};

public static SpellRow GetFirstAttackSpell(this MappedDB db, zzio.ZZClass zzClass, uint level) =>
db.Spells.First(s => s.Type == 0 && IsSpellCompatible(s, zzClass, level));
db.Spells.OrderBy(s => s.CardId.EntityId).First(s => s.Type == 0 && IsSpellCompatible(s, zzClass, level));

public static (SpellRow? attack0, SpellRow? support0, SpellRow? attack1, SpellRow? support1) GetRandomSpellSet(this MappedDB db, Random random, zzio.ZZClass zzClass, uint level)
{
Expand Down

0 comments on commit 68c7f8b

Please sign in to comment.