Skip to content

Commit

Permalink
fix: attack counters for Titan cards
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoraes74 committed Oct 27, 2023
1 parent 8f4ad03 commit 7294afa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion HSTracker/Logging/Enums/GameTag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,16 @@ enum GameTag: Int, WrappableEnum, CaseIterable, Codable {
bacon_hero_heropower_quest_reward_database_id = 2714,
bacon_hero_quest_reward_completed = 2715,
bacon_hero_heropower_quest_reward_completed = 2716,
titan = 2772,
bacon_bloodgembuffhealthvalue = 2827,
venomous = 2853,
gametag_2878 = 2878,
bacon_global_anomaly_dbid = 2897,
cthun_health_buff = 3053,
cthun_attack_buff = 3054
cthun_attack_buff = 3054,
titan_ability_used_1 = 3140,
titan_ability_used_2 = 3141,
titan_ability_used_3 = 3142

static var lookup = [String: GameTag]()

Expand Down
16 changes: 15 additions & 1 deletion HSTracker/Utility/BoardDamage/BoardCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class BoardCard: IBoardEntity {
private(set) var attacksThisTurn = 0
private(set) var exhausted = false
private(set) var dormant = false
private(set) var titan = false
private(set) var titanAbilitiesUsed = 0

private(set) var zone = ""

Expand All @@ -51,6 +53,18 @@ class BoardCard: IBoardEntity {
windfury = entity[.windfury] == 1
attacksThisTurn = entity[.num_attacks_this_turn]
dormant = entity[.dormant] == 1
titan = entity[.titan] == 1
if titan {
if entity[.titan_ability_used_1] == 1 {
titanAbilitiesUsed += 1
}
if entity[.titan_ability_used_2] == 1 {
titanAbilitiesUsed += 1
}
if entity[.titan_ability_used_3] == 1 {
titanAbilitiesUsed += 1
}
}

cardId = entity.cardId
taunt = entity[.taunt] == 1
Expand Down Expand Up @@ -92,7 +106,7 @@ class BoardCard: IBoardEntity {
private func isAbleToAttack(active: Bool, isWeapon: Bool) -> Bool {
// TODO: if frozen on turn, may be able to attack next turn
// don't include weapons if an active turn, count Hero instead
if _cantAttack || _frozen || (isWeapon && active) {
if _cantAttack || _frozen || (isWeapon && active) || dormant || (titan && titanAbilitiesUsed < 3) {
return false
}
if !active {
Expand Down

0 comments on commit 7294afa

Please sign in to comment.