Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add daybreak cac effects #60

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified BSG Moderator Template.ods
Binary file not shown.
49 changes: 48 additions & 1 deletion BSG Moderator Template/Basic/Standard/BoardStatus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,15 @@ sub Board_SetSpecial (effect as string)
case "The Guardians"
offseth = 7
offsetv = -4
case "Lockdown"
offseth = 7
offsetv = -6
case "Hornet's Nest"
offseth = 7
offsetv = -7
case "Event Horizon"
offseth = 7
offsetv = -2
case else
foundeffect = FALSE
end select
Expand Down Expand Up @@ -516,7 +525,31 @@ sub Board_ClearSpecial (which as string)
LogThis "Special: The Guardians are no longer in effect."
end if
end if

if BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).String <> "" then
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).String = ""
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).CellBackColor = _white
if which <> "All" then
MsgBox "Special: Lockdown is no longer in effect."
LogThis "Special: Lockdown is no longer in effect."
end if
end if
if BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).String <> "" then
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).String = ""
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).CellBackColor = _white
if which <> "All" then
MsgBox "Special: Hornet's Nest is no longer in effect."
LogThis "Special: Hornet's Nest is no longer in effect."
end if
end if
if BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-2).String <> "" then
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-2).String = ""
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-2).CellBackColor = _white
if which <> "All" then
MsgBox "Special: Event Horizon is no longer in effect."
LogThis "Special: Event Horizon is no longer in effect."
end if
end if

if which = "All" then
BoardSheet.GetCellByPosition(_DetectorCol,_DetectorRow).String = ""
BoardSheet.GetCellByPosition(_DetectorCol,_DetectorRow).CellBackColor = _white
Expand Down Expand Up @@ -563,6 +596,20 @@ sub Board_ClearSpecial (which as string)
MsgBox "Special: Dogfight is no longer in effect."
LogThis "Special: Dogfight is no longer in effect."
end if
elseif which = "Lockdown" then
if BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).String <> "" then
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).String = ""
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-6).CellBackColor = _white
MsgBox "Special: Lockdown is no longer in effect."
LogThis "Special: Lockdown is no longer in effect."
end if
elseif which = "Hornet's Nest" then
if BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).String <> "" then
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).String = ""
BoardSheet.GetCellByPosition(_SpecialsCol+7,_SpecialsRow-7).CellBackColor = _white
MsgBox "Special: Hornet's Nest is no longer in effect."
LogThis "Special: Hornet's Nest is no longer in effect."
end if
end if
end sub

Expand Down
10 changes: 9 additions & 1 deletion BSG Moderator Template/Basic/Standard/Ships.xml
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,13 @@ sub SetShipStatus (shiptype, shipid, ByVal targetstatus, optional seldamage as s
exit sub
elseif targetstatus = _ShipStatusDestroyed then
Board_ClearSpecial("Thirty-Three")
Board_ClearSpecial("Lockdown")
Board_ClearSpecial("Hornet's Nest")
targetstatus = _ShipStatusOffBoard
elseif targetstatus = _ShipStatusRemoved then
Board_ClearSpecial("Thirty-Three")
Board_ClearSpecial("Lockdown")
Board_ClearSpecial("Hornet's Nest")
targetstatus = _ShipStatusDestroyed
end if
end if
Expand Down Expand Up @@ -932,6 +936,10 @@ sub SetShipStatus (shiptype, shipid, ByVal targetstatus, optional seldamage as s
end if
if shiptype =_ShipCivilian or shiptype =_ShipBasestar then
Board_ClearSpecial("Thirty-Three")
if shiptype =_ShipBasestar then
Board_ClearSpecial("Lockdown")
Board_ClearSpecial("Hornet's Nest")
end if
end if
else
ShipSheet.GetCellByPosition(ShipCol(ShipType, _ShipColDestroyed), ShipRow(ShipType) + ShipID).string = ""
Expand Down Expand Up @@ -2111,4 +2119,4 @@ function RepairVipers (shiptype as integer, shipcnt as integer)
next i
end function

</script:module>
</script:module>
6 changes: 3 additions & 3 deletions BSG-Pegasus.scm
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
1 3 1 7 7
7 1 7 7 7 7 4 2 8 2 8
5 4 9
10 38 12 12 12 1 8 9
10 38 12 12 12 1 11 9
2 5 30 6 1
7 6 7 4 4
12 14 6 6 32 6
Expand Down Expand Up @@ -803,13 +803,13 @@
)
(set! voffset (quotient specialcnt 2))
(set! specoff 0)
(while (< specoff 8)
(while (< specoff 11)
(when (string=5? (car (gimp-layer-get-name (vector-ref mylayers (+ c_specpos specoff)))) (car myvalues))
(begin
(gimp-drawable-set-visible (vector-ref mylayers (+ c_specpos specoff)) TRUE)
(gimp-layer-translate (vector-ref mylayers (+ c_specpos specoff)) (* hoffset 700) (* voffset 36))
(set! specialcnt (++ specialcnt))
(set! specoff 8)
(set! specoff 11)
)
) ;when
(set! specoff (++ specoff))
Expand Down
39 changes: 38 additions & 1 deletion BSG-Util.scm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,43 @@
(define (++ srcval) (let* ()(+ srcval 1)))
(define (-- srcval) (let* ()(- srcval 1)))

; This reads either the next string, or the rest of the line as a scheme symbol
; This is to work around the changes to how the "read" builtin handles the " deliminator
; between tinyscheme 1.40 and 1.41, which breaks the assumptions in getcvsline and
; causes it to fail with gimp 2.10
(define (readstringorsymbol in)
(let*
(
(valuelst '())
(templst '())
(tempstr nil)
(symbolstr nil)
(nextitem nil)
)
(set! nextitem (read in))
(if (and (symbol? (list-ref nextitem 1)) (not (char-ci=? (peek-char in) #\newline)))
(begin
; We have a symbol, but we didn't read to the newline, so we have to create
; a symbol with the rest of the line
(while (not (char-ci=? (peek-char in) #\newline))
(set! templst (append templst (list (read-char in))))
) ; while
(set! tempstr (list->string templst))
(set! symbolstr (symbol->string (list-ref nextitem 1)))
(set! symbolstr (string-append symbolstr tempstr))
(set! valuelst (append valuelst (list (list-ref nextitem 0))))
(set! valuelst (append valuelst (list (string->symbol symbolstr))))
)
(begin
; else we just return the read results
(set! valuelst nextitem)
)
) ; if
(set! valuelst valuelst)
) ; let
) ; define


; Reading from the csv is a strange process. Each line will start with a string. The first string of the first line should have
; already been read when this is called. each call of this reads everyhing after the first string and builds it in a list (A), then
; reads the first string of the next line (B) and returns a list comprising ((A) (B)).
Expand All @@ -56,7 +93,7 @@
(logflag FALSE)
(havenexttok nil)
)
(set! nextitem (read in))
(set! nextitem (readstringorsymbol in))
(set! valuelst '())
(while (not (or (string? nextitem) (eof-object? nextitem)))
(set! havenexttok FALSE)
Expand Down
Binary file modified BSGP - MASTER.xcf
Binary file not shown.
1 change: 1 addition & 0 deletions Image_Tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
results
Binary file added Image_Tests/Reference_Images/BSGP TEST - 1.1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image_Tests/Reference_Images/BSGP TEST - 1.2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Image_Tests/Reference_Images/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
These are images of the test csv files generated by using Gimp 2.8.22 on a Linux x86_64
machine.

Images generated by other gimp version should be identical, barring jpeg compression artifacts.
67 changes: 67 additions & 0 deletions Image_Tests/data/BSGP TEST - 1.1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"Game","TEST","1.1","Pegasus","Exodus","Daybreak","NoRevelations","Ionian Earth","Standard","log",,,,,,
"Characters","Baltar","Cain","Starbuck","Chief","Helo","Anders","",,,,,,,,
";Option",,,,,,,,,,,,,,,
"Resources",8,8,10,12,,,,,,,,,,,
"PlayerCards",0,0,0,0,0,0,0,,,,,,,,
"PlayerLocations","Research Lab","Pegasus CIC","Hangar Deck","Hangar Deck","Stranded on Caprica","Armory","",,,,,,,,
"SkillDecks",33,33,33,33,33,24,0,,,,,,,,
"Reserves",0,3,4,0,0,1,,,,,,,,,
"Decks",12,143,30,28,0,12,21,"",,,,,,,
"CivShips",7,0,0,,,,,,,,,,,,
"Roles",1,5,1,2,2,0,1,,,,,,,,
"JumpTrack",0,"",,,,,,,,,,,,,
";GamePhase",1,,,,,,,,,,,,,,
"Assignments","STRA",5,"","","","","","",,,,,,,
";BoardingParty",0,0,0,0,,,,,,,,,,,
";OccForce",0,0,0,,,,,,,,,,,,
";Distance","","","","","","","","","",,,,,,
"BoardSpecial","","","","","","","","","The Guardians","","","","Lockdown","",""
"OPG",1,1,1,1,1,1,"",,,,,,,,
";Damage","","","","","","","","","","","","",,,
";Graveyard","","","","","","","","","",,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
"Basestar",1,"","",,,,,,,,,,,,
"Basestar",1,"","",,,,,,,,,,,,
";Scar","",,,,,,,,,,,,,,
";Option",0,,,,,,,,,,,,,,
"Sector",1,0,3,0,0,0,,,,,,,,,
"Sector",2,0,2,0,0,0,,,,,,,,,
"Sector",3,1,0,0,0,0,,,,,,,,,
"Sector",4,0,0,1,0,0,,,,,,,,,
"Sector",5,0,0,2,0,0,,,,,,,,,
"Sector",6,0,2,2,0,0,,,,,,,,,
"Civilians",4,"A",,,,,,,,,,,,,
"Civilians",4,"B",,,,,,,,,,,,,
"Civilians",4,"C",,,,,,,,,,,,,
"Civilians",4,"D",,,,,,,,,,,,,
"Civilians",5,"E",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Civilians","","",,,,,,,,,,,,,
";Option",,,,,,,,,,,,,,,
"Option","JPG",,,,,,,,,,,,,,
";CylonFleet",1,0,0,,,,,,,,,,,,
";CylonFleet",2,0,0,,,,,,,,,,,,
";CylonFleet",3,0,0,,,,,,,,,,,,
";CylonFleet",4,0,0,,,,,,,,,,,,
";CylonFleet",5,0,0,,,,,,,,,,,,
";CylonFleet",6,0,0,,,,,,,,,,,,
"Allies","Alex �Crashdown� Quartararo","Armory","Laura Roslin","President's Office","Tory Foster","Press Room",,,,,,,,,
"Trauma",3,3,3,3,3,3,0,,,,,,,,
"LoyaltyCards",2,1,1,1,1,1,0,,,,,,,,
"BGColor","Match",43,58,102,,,,,,,,,,,
"ResourceDamage",0,0,,,,,,,,,,,,,
"DamagedCivilians",0,0,0,0,0,,,,,,,,,,
"Mutiny",1,0,0,0,0,0,0,,,,,,,,
"SearchForHome","Unallied","None","None",,,,,,,,,,,,
"DestroyedBasestar",0,0,,,,,,,,,,,,,
67 changes: 67 additions & 0 deletions Image_Tests/data/BSGP TEST - 1.2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"Game","TEST","1.2","Pegasus","Exodus","Daybreak","NoRevelations","Ionian Earth","Standard","log",,,,,,
"Characters","Baltar","Cain","Starbuck","Chief","Helo","Anders","",,,,,,,,
"Option","OutlineCounters",,,,,,,,,,,,,,
"Resources",8,8,10,12,,,,,,,,,,,
"PlayerCards",0,0,0,0,0,0,0,,,,,,,,
"PlayerLocations","Research Lab","Pegasus CIC","Resurrection Ship","Hangar Deck","Stranded on Caprica","Armory","",,,,,,,,
"SkillDecks",33,33,33,33,33,24,0,,,,,,,,
"Reserves",0,1,4,0,0,1,,,,,,,,,
"Decks",12,124,30,28,0,11,21,"",,,,,,,
"CivShips",0,0,0,,,,,,,,,,,,
"Roles",2,5,1,2,2,0,1,,,,,,,,
"JumpTrack",0,"",,,,,,,,,,,,,
";GamePhase",1,,,,,,,,,,,,,,
"Assignments","STRA",5,"","","","","","",,,,,,,
";BoardingParty",0,0,0,0,,,,,,,,,,,
";OccForce",0,0,0,,,,,,,,,,,,
";Distance","","","","","","","","","",,,,,,
"BoardSpecial","","","Jammed Assault","Thirty-Three","","","","","","","","Hornet's Nest","Lockdown","",""
"OPG",1,1,0,1,1,1,"",,,,,,,,
";Damage","","","","","","","","","","","","",,,
";Graveyard","","","","","","","","","",,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
"Cylons",3,"C",1,0,,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
";Cylons","","","","",,,,,,,,,,,
"Basestar",1,"","",,,,,,,,,,,,
"Basestar",2,"","",,,,,,,,,,,,
";Scar","",,,,,,,,,,,,,,
";Option",0,,,,,,,,,,,,,,
"Sector",1,2,6,0,0,0,,,,,,,,,
"Sector",2,2,4,0,0,0,,,,,,,,,
";Sector",3,0,0,0,0,0,,,,,,,,,
"Sector",4,0,3,1,0,0,,,,,,,,,
"Sector",5,0,0,3,0,0,,,,,,,,,
"Sector",6,0,0,3,0,0,,,,,,,,,
"Civilians",4,"A",,,,,,,,,,,,,
"Civilians",4,"B",,,,,,,,,,,,,
"Civilians",4,"C",,,,,,,,,,,,,
"Civilians",5,"D",,,,,,,,,,,,,
"Civilians",1,"E",,,,,,,,,,,,,
"Civilians",4,"F",,,,,,,,,,,,,
"Civilians",5,"G",,,,,,,,,,,,,
"Civilians",6,"H",,,,,,,,,,,,,
"Civilians",3,"I",,,,,,,,,,,,,
"Civilians",4,"J",,,,,,,,,,,,,
"Civilians",5,"K",,,,,,,,,,,,,
"Civilians",6,"L",,,,,,,,,,,,,
";Option",,,,,,,,,,,,,,,
"Option","JPG",,,,,,,,,,,,,,
";CylonFleet",1,0,0,,,,,,,,,,,,
";CylonFleet",2,0,0,,,,,,,,,,,,
";CylonFleet",3,0,0,,,,,,,,,,,,
";CylonFleet",4,0,0,,,,,,,,,,,,
";CylonFleet",5,0,0,,,,,,,,,,,,
";CylonFleet",6,0,0,,,,,,,,,,,,
"Allies","Alex �Crashdown� Quartararo","Armory","Laura Roslin","President's Office","Tory Foster","Press Room",,,,,,,,,
"Trauma",3,3,3,3,3,3,0,,,,,,,,
"LoyaltyCards",2,1,0,1,1,1,0,,,,,,,,
"BGColor","Match",43,58,102,,,,,,,,,,,
"ResourceDamage",0,0,,,,,,,,,,,,,
"DamagedCivilians",0,0,0,0,0,,,,,,,,,,
"Mutiny",1,0,0,0,0,0,0,,,,,,,,
"SearchForHome","Unallied","None","None",,,,,,,,,,,,
"DestroyedBasestar",0,0,,,,,,,,,,,,,
Binary file added Image_Tests/data/BSGP TEST - MASTER.xcf
Binary file not shown.
46 changes: 46 additions & 0 deletions Image_Tests/make_diff_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/python3
#
# Use the python imaging library to construct a difference image between the results
# and reference images

import sys
import os

from PIL import Image


def do_cmp():
basedir = os.path.dirname(sys.argv[0])
reference = os.path.join(basedir, 'Reference_Images')
results = os.path.join(basedir, 'results')

files = os.listdir(reference)

for cand in files:
if not cand.endswith('.jpg'):
continue
cand_result = os.path.join(results, cand)
if not os.path.exists(cand_result):
print(f"Missing results image: {cand}")
continue
ref1 = Image.open(os.path.join(reference, cand))
result1 = Image.open(cand_result)
if ref1.width != result1.width:
print(f"{cand_result} and {cand} have different widths - Cannot compare")
if ref1.height != result1.height:
print(f"{cand_result} and {cand} have different heights - Cannot compare")
diff = Image.new('RGB', (ref1.width, ref1.height))
diff_name = cand_result.replace('.jpg','-diff.jpg')
for x in range(ref1.width):
for y in range(ref1.height):
p1 = ref1.getpixel((x,y))
p2 = result1.getpixel((x,y))
val = [abs(p1[i] - p2[i]) for i in range(3)]
val = tuple([x if x < 255 else 255 for x in val])
diff.putpixel((x, y), val)
diff.save(diff_name)


if __name__ == "__main__":
do_cmp()

17 changes: 17 additions & 0 deletions Image_Tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e
# Runs the image generation tests using the default version of the gimp
IFS='
'

mkdir -p results
rm -f results/*jpg
cd data
for x in *csv; do
fullname=$(readlink -f "$x")
gimp -i -b "(script-fu-BSGP-Run-Batch \"$fullname\")" -b '( gimp-quit 1 )'
mv ${x/csv/jpg} ../results
rm ${x/csv/xcf}
rm *log
done