Skip to content

Commit

Permalink
Update SinfulSpoilsOfDoom_Rciela
Browse files Browse the repository at this point in the history
  • Loading branch information
Wind2009-Louse committed Oct 13, 2023
1 parent 6b50fed commit 2cdb64e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
26 changes: 21 additions & 5 deletions Game/AI/Decks/DogmatikaExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public DogmatikaExecutor(GameAI ai, Duel duel)
const int SetcodeOrcust = 0x11b;
const int SetcodeDogmatika = 0x145;
const int hintTimingMainEnd = 0x4;
const int hintDamageStep = 0x2000;

Dictionary<int, List<int>> DeckCountTable = new Dictionary<int, List<int>>{
{3, new List<int> { CardId.DogmatikaEcclesia, _CardId.AshBlossom, _CardId.MaxxC, CardId.KnightmareCorruptorIblee, CardId.NadirServant,
Expand Down Expand Up @@ -1094,10 +1095,22 @@ public override void OnMove(int cardId, int previousControler, int previousLocat
base.OnMove(cardId, previousControler, previousLocation, currentControler, currentLocation);
}

public override ClientCard OnSelectAttacker(IList<ClientCard> attackers, IList<ClientCard> defenders)
public override BattlePhaseAction OnBattle(IList<ClientCard> attackers, IList<ClientCard> defenders)
{
if (attackers.Count() > 0) return attackers.OrderBy(card => card.Attack).FirstOrDefault();
return base.OnSelectAttacker(attackers, defenders);
if (attackers.Count() > 0 && defenders.Count() > 0)
{
List<ClientCard> sortedAttacker = attackers.OrderBy(card => card.Attack).ToList();
for (int k = 0; k < sortedAttacker.Count; ++k)
{
ClientCard attacker = sortedAttacker[k];
attacker.IsLastAttacker = k == sortedAttacker.Count - 1;
BattlePhaseAction result = OnSelectAttackTarget(attacker, defenders);
if (result != null)
return result;
}
}

return base.OnBattle(attackers, defenders);
}

public override BattlePhaseAction OnSelectAttackTarget(ClientCard attacker, IList<ClientCard> defenders)
Expand Down Expand Up @@ -2023,7 +2036,8 @@ public bool SinfulSpoilsOfDoom_RcielaActivate()
if (!onlyAlbaZoa)
{
List<ClientCard> toDestroyMonsterList = Enemy.GetMonsters().Where(card => card.IsFaceup()
&& card.Attack > 0 && card.Attack <= targetAttack && !currentDestroyCardList.Contains(card)).ToList();
&& card.Attack > 0 && card.Attack <= targetAttack && !currentDestroyCardList.Contains(card)
&& (Duel.Player == 1 || card != Enemy.BattlingMonster)).ToList();
if (toDestroyMonsterList.Count() > 1)
{
activateFlag = true;
Expand All @@ -2032,7 +2046,9 @@ public bool SinfulSpoilsOfDoom_RcielaActivate()
}

// decrease attack
if (Bot.UnderAttack && !onlyAlbaZoa && (Bot.BattlingMonster?.GetDefensePower() ?? 0) <= (Enemy.BattlingMonster?.GetDefensePower() ?? 0) && Duel.LastChainPlayer != 0)
if (Bot.UnderAttack && (!onlyAlbaZoa || (Bot.BattlingMonster?.IsCode(CardId.DogmatikaAlbaZoa) ?? false))
&& (Bot.BattlingMonster?.GetDefensePower() ?? 0) <= (Enemy.BattlingMonster?.GetDefensePower() ?? 0)
&& Duel.LastChainPlayer != 0 && (CurrentTiming & hintDamageStep) != 0)
{
activateFlag = true;
}
Expand Down
9 changes: 8 additions & 1 deletion Game/AI/DefaultExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ protected class _CardId
public const int SpiralDischarge = 29477860;
public const int GaiaTheDragonChampion = 66889139;
public const int CrusadiaVanguard = 55312487;
public const int GladiatorBeastDomitianus = 33652635;
public const int PatricianOfDarkness = 19153634;
public const int DictatorOfD = 66961194;
}

protected class _Setcode
Expand All @@ -197,6 +200,7 @@ protected class _Setcode
public const int Ghostrick = 0x8d;
public const int OddEyes = 0x99;
public const int Performapal = 0x9f;
public const int BlueEyes = 0xdd;
public const int FurHire = 0x114;
public const int Altergeist = 0x103;
public const int Crusadia = 0x116;
Expand Down Expand Up @@ -414,7 +418,10 @@ public override bool OnPreBattleBetween(ClientCard attacker, ClientCard defender
if (defender.HasSetcode(_Setcode.EarthboundImmortal) && !defender.IsDisabled())
return false;

if (Enemy.HasInMonstersZone(_CardId.RockOfTheVanquisher, true) && Enemy.GetMonsters().Any(card => card.HasSetcode(_Setcode.VanquishSoul)))
bool attackHighestMonster = Enemy.HasInMonstersZone(_CardId.RockOfTheVanquisher, true) && Enemy.GetMonsters().Any(card => card.HasSetcode(_Setcode.VanquishSoul));
attackHighestMonster |= Enemy.HasInMonstersZone(_CardId.GladiatorBeastDomitianus, true) || Enemy.HasInMonstersZone(_CardId.PatricianOfDarkness);
attackHighestMonster |= Enemy.HasInMonstersZone(_CardId.DictatorOfD, true) && Enemy.GetMonsters().Any(card => card.HasSetcode(_Setcode.BlueEyes));
if (attackHighestMonster)
{
if (defender.HasPosition(CardPosition.FaceDown)) return false;
if (Enemy.GetMonsters().Any(card => card.IsFaceup() && card.Attack > defender.Attack)) return false;
Expand Down
4 changes: 2 additions & 2 deletions Game/GameBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ private void OnSelectChain(BinaryReader packet)
int count = packet.ReadByte();
packet.ReadByte(); // specount
bool forced = packet.ReadByte() != 0;
packet.ReadInt32(); // hint1
int hint1 = packet.ReadInt32(); // hint1
int hint2 = packet.ReadInt32(); // hint2

IList<ClientCard> cards = new List<ClientCard>();
Expand Down Expand Up @@ -1124,7 +1124,7 @@ private void OnSelectChain(BinaryReader packet)
return;
}

Connection.Send(CtosMessage.Response, _ai.OnSelectChain(cards, descs, forced, hint2));
Connection.Send(CtosMessage.Response, _ai.OnSelectChain(cards, descs, forced, hint1 | hint2));
}

private void OnSelectCounter(BinaryReader packet)
Expand Down

0 comments on commit 2cdb64e

Please sign in to comment.