From 68c7f8b09917be04d70f776d9137f43bedafd479 Mon Sep 17 00:00:00 2001 From: Helco Date: Tue, 10 Oct 2023 20:27:00 +0200 Subject: [PATCH] zzre: Fix GetFirstAttackSpell --- zzre/game/StdSpellId.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zzre/game/StdSpellId.cs b/zzre/game/StdSpellId.cs index 3c198150..5107e0ba 100644 --- a/zzre/game/StdSpellId.cs +++ b/zzre/game/StdSpellId.cs @@ -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; @@ -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) {