Skip to content

Commit

Permalink
Fix for Icekin WPA OP bonus
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeaumont committed Nov 5, 2023
1 parent 7b2933d commit 4ad88f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions dbupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
database = Database()
database.init(DATABASE)
database.executescript(sys.argv[1])
database.close()
9 changes: 9 additions & 0 deletions domain/refdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from enum import Enum
from collections import defaultdict, namedtuple
from config import REF_DATA_DIR
from domain.unknown import Unknown

NON_HOME_CAPACITY = 15
BUILD_TICKS = 12
Expand Down Expand Up @@ -122,6 +123,14 @@ def cost(self) -> dict:
def offense(self) -> float:
op = self._data['power']['offense']
op += self.land_bonus('offense_from_land')
if self.has_perk('offense_raw_wizard_ratio'):
per_percent, max_bonus = self.get_perk('offense_raw_wizard_ratio')
if not isinstance(self.dom.cs, Unknown) and self.dom.cs['wpa']:
wpa = float(self.dom.cs['wpa'])
wpa_bonus = wpa * float(per_percent)
if wpa_bonus > float(max_bonus):
wpa_bonus = float(max_bonus)
op += wpa_bonus
return op

@property
Expand Down
4 changes: 4 additions & 0 deletions opsdata/schema-updates/update-1.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INSERT INTO SchemaVersion (timestamp, version) VALUES (DATETIME('now'), '1.1');

/* Add wpa column to deal with Icekin OP calc */
ALTER TABLE ClearSight ADD COLUMN wpa REAL;
3 changes: 2 additions & 1 deletion opsdata/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ def query_last_ops(db):
'military_spies': 'status.military_spies|optional',
'military_assassins': 'status.military_assassins|optional',
'military_wizards': 'status.military_wizards|optional',
'military_archmages': 'status.military_archmages|optional'
'military_archmages': 'status.military_archmages|optional',
'wpa': 'status.wpa|optional'
}


Expand Down

0 comments on commit 4ad88f1

Please sign in to comment.