Skip to content

Commit a965d7a

Browse files
committed
Fix health calculation
1 parent 640502a commit a965d7a

22 files changed

+66
-37
lines changed

README.md

+33-30
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Easily and automatically create **Victory at Sea** ship cards for your 3D-printed or custom ships! This project mimics the style, size, and information layout of the official cards provided by **Warlord Games** while allowing you to customize ships you’ve printed yourself.
44

5-
![Project Demo Screenshot](./output_images/New_Mexico.png) <!-- Replace with an actual screenshot -->
6-
5+
![Project Demo Screenshot](./output_images/New_Mexico_Class_Battleship.png)
76
---
87

98
## Features
@@ -68,19 +67,18 @@ project_root/
6867

6968
Defines the basic information about each ship.
7069

71-
72-
| Field | Description | Example |
73-
|----------------|----------------------------------------------------|---------------------------|
74-
| `ship_id` | Unique ID for the ship | `1` |
75-
| `ship_name` | Name of the ship | `New Mexico` |
76-
| `ship_type` | Type of the ship | `Battleship` |
77-
| `points` | Point cost | `395` |
78-
| `flank_speed` | Flank speed in inches | `4"` |
79-
| `armour` | Ship's armor rating | `6+` |
80-
| `hull` | Ship's hull value (current/max) | `72/24` |
81-
| `traits` | Special traits | `Aircraft 4, Armoured Deck, Torpedo Belt 2` |
82-
| `ship_image` | Path to the ship image relative to the ship_images folder | `new_mexico.png` |
83-
| `nation` | Path to the nation's image relative to the flags folder | `usa.png`
70+
| Field | Description | Example |
71+
| ------------- | --------------------------------------------------------- | ------------------------------------------- |
72+
| `ship_id` | Unique ID for the ship | `1` |
73+
| `ship_name` | Name of the ship | `New Mexico` |
74+
| `ship_type` | Type of the ship | `Battleship` |
75+
| `points` | Point cost | `395` |
76+
| `flank_speed` | Flank speed in inches | `4"` |
77+
| `armour` | Ship's armor rating | `6+` |
78+
| `hull` | Ship's hull value (current/max) | `72/24` |
79+
| `traits` | Special traits | `Aircraft 4, Armoured Deck, Torpedo Belt 2` |
80+
| `ship_image` | Path to the ship image relative to the ship_images folder | `new_mexico.png` |
81+
| `nation` | Path to the nation's image relative to the flags folder | `usa.png` |
8482

8583
#### Example
8684

@@ -94,29 +92,31 @@ ship_id,ship_name,ship_type,points,flank_speed,armour,hull,traits,ship_image
9492

9593
Defines the weapon systems for each ship.
9694

97-
98-
| Field | Description | Example |
99-
|-----------------|--------------------------------------------------|---------------|
100-
| `ship_id` | ID matching the ship from `ships.csv` | `1` |
101-
| `weapon_system` | Name of the weapon system | `A Turret` |
102-
| `fire_arc` | Firing arc of the weapon | `Fore` |
103-
| `point_blank` | Point-blank range | `9"` |
104-
| `short` | Short range | `18"` |
105-
| `long` | Long range | `27"` |
106-
| `extreme` | Extreme range | `37"` |
107-
| `ad` | Attack dice | `3` |
108-
| `ap` | Armor penetration | `+2` |
109-
| `dd` | Damage dice | `3` |
110-
| `traits` | Special traits | `-` |
95+
| Field | Description | Example |
96+
| --------------- | ------------------------------------- | ---------- |
97+
| `ship_id` | ID matching the ship from `ships.csv` | `1` |
98+
| `weapon_system` | Name of the weapon system | `A Turret` |
99+
| `fire_arc` | Firing arc of the weapon | `Fore` |
100+
| `point_blank` | Point-blank range | `9"` |
101+
| `short` | Short range | `18"` |
102+
| `long` | Long range | `27"` |
103+
| `extreme` | Extreme range | `37"` |
104+
| `ad` | Attack dice | `3` |
105+
| `ap` | Armor penetration | `+2` |
106+
| `dd` | Damage dice | `3` |
107+
| `traits` | Special traits | `-` |
111108

112109
#### Fire Arcs
110+
113111
##### Valid Fire Arcs
112+
114113
Fire arcs are case-insensitive and support the following single or combined arcs:
115114

116115
- Single arcs: `Fore`, `Aft`, `Port`, `Starboard`
117116
- Combined arcs are seperated by a comma: `Fore, Aft`
118117

119118
##### Fire Arc Images
119+
120120
Fire arc images are generated using the `createArc.py` script. These images will be stored in the fire_arcs/ folder and linked dynamically on the ship cards.
121121

122122
#### Example
@@ -146,6 +146,7 @@ python generate.py
146146
### Running via Executable
147147

148148
1. Ensure you have the following files and folders in the same directory as the executable:
149+
149150
- `ships.csv`: Contains ship data.
150151
- `weapon_systems.csv`: Contains weapon data.
151152
- `ship_images/`: Directory for ship images.
@@ -154,11 +155,13 @@ python generate.py
154155
2. Place the executable in the root directory of your setup.
155156

156157
3. Run the executable:
158+
157159
- On Windows:
158160
```cmd
159161
VictoryAtSeaCardGenerator.exe
160162
```
161163
- On Linux/Mac:
164+
162165
```bash
163166
./VictoryAtSeaCardGenerator
164167
```
@@ -178,7 +181,7 @@ Generated cards will be saved in the `output_images/` folder.
178181
179182
### Donate
180183
181-
To help me with creating new awesome tools and models you can
184+
To help me with creating new awesome tools and models you can
182185
183186
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/mstelz)
184187

VASCardGenerator.exe

0 Bytes
Binary file not shown.

createExecutable.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pyinstaller --onefile --name VASCardGenerator --add-data "fonts:fonts" --add-data "shipcard.html:." generate.py
2+
mv ./dist/VASCardGenerator.exe .
3+
rm -rf dist
4+
rm -rf build

generate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def draw_vertical_lines(image_path, num_top_lines):
224224
driver.save_screenshot(screenshot_path)
225225

226226
# Add vertical lines after ensuring the image has been saved at 300 DPI
227-
draw_vertical_lines(screenshot_path, int(str(ship["hull"]).split("/")[0][0]))
227+
draw_vertical_lines(screenshot_path, int(str(ship["hull"]).split("/")[0]) // 10)
228228

229229
# Clean up the temporary HTML file
230230
os.remove(temp_html_path)
347 KB
Loading

output_images/Essex.png

-315 KB
Binary file not shown.

output_images/Essex_Class_Carrier.png

325 KB
Loading

output_images/John_C._Butler.png

-396 KB
Binary file not shown.
Loading

output_images/Kagero.png

-459 KB
Binary file not shown.
447 KB
Loading

output_images/Liner.png

247 KB
Loading

output_images/New_Mexico.png

-529 KB
Binary file not shown.
532 KB
Loading

output_images/Oil_Tanker.png

242 KB
Loading

output_images/Seaplane_Tender.png

251 KB
Loading

output_images/Tramp_Freighter.png

212 KB
Loading

output_images/Troop_Ship.png

244 KB
Loading
260 KB
Loading

shipcard.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<div class="header">
117117
<div class="title">
118118
${nation_html} <!-- Dynamically insert the nation flag image -->
119-
<h1>${ship_name} CLASS ${ship_type}</h1>
119+
<h1>${ship_name}</h1>
120120
</div>
121121

122122
${ship_image_html} <!-- Dynamically insert the ship image -->

ships.csv

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
ship_id,ship_name,ship_type,points,flank_speed,armour,hull,traits,ship_image,nation
2-
1,Essex,Carrier,270,"6""",3+,70/23,"Advanced Radar, Carrier, Torpedo Belt 3",essex.png,usa.png
3-
2,New Mexico,Battleship,395,"4""",6+,72/24,"Aircraft 4, Armoured Deck, Torpedo Belt 2",new_mexico.png,usa.png
4-
3,John C. Butler,Destroyer,60,"5""",1+,4/1,"Agile, Advanced Radar, Sub-Hunter, Depth Charge, Hedgehogs",john-c-butler.png,usa.png
5-
4,Kagero,Destroyer,100,"7""",1+,5/2,"Agile, Depth Charge",kagero-class.png,japan.png
2+
1,Essex Class Carrier,Carrier,270,"6""",3+,70/23,"Advanced Radar, Carrier, Torpedo Belt 3",essex.png,usa.png
3+
2,New Mexico Class Battleship,Battleship,395,"4""",6+,72/24,"Aircraft 4, Armoured Deck, Torpedo Belt 2",new_mexico.png,usa.png
4+
3,John C. Butler Class Destroyer,Destroyer,60,"5""",1+,4/1,"Agile, Advanced Radar, Sub-Hunter, Depth Charge, Hedgehogs",john-c-butler.png,usa.png
5+
4,Kagero Class Destroyer,Destroyer,100,"7""",1+,5/2,"Agile, Depth Charge",kagero-class.png,japan.png
6+
5,6-Gun Armed Merchant Cruiser,Civilian,25,"3""",1+,15/5,Lumbering,,
7+
6,Liner,Civilian,25,"6""",1+,72/24,Lumbering,,
8+
7,Oil Tanker,Civilian,30,"4""",1+,15/5,Lumbering,,
9+
8,Seaplane Tender,Civilian,25,"4""",1+,12/4,"Aircraft 6, Lumbering",,
10+
9,Tramp Freighter,Civilian,10,"2""",1+,6/2,,,
11+
10,Troop Ship,Civilian,25,"3""",1+,16/5,Lumbering,,
12+
11,Victory Class Cargo Ship,Civilian,30,"3""",1+,14/4,Lumbering,,

weapon_systems.csv

+16-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,19 @@ ship_id,weapon_system,fire_arc,point_blank,short,long,extreme,ad,ap,dd,traits
1414
4,Light Guns (6 x 5-inch),"Fore, Aft, Port, Starboard","5""","10""","15""","20""",3,2,1,Weak
1515
4,AA Battery,"Fore, Aft, Port, Starboard",-,-,-,-,-,-,-,Local 1
1616
4,Port/Starboard Type 93 Torpedoes,"Port, Starboard","8""","17""","25""","34""",4,-,3,"Devastating, Slow-Loading, Wakeless"
17-
4,Port/Starboard Type 93 Torpedoes,"Port, Starboard","8""","17""","25""","34""",4,-,3,"Devastating, Slow-Loading, Wakeless"
17+
4,Port/Starboard Type 93 Torpedoes,"Port, Starboard","8""","17""","25""","34""",4,-,3,"Devastating, Slow-Loading, Wakeless"
18+
5,Light Guns (6 x 6-inch),"Fore, Aft, Port, Starboard","4""","9""","13""","18""",4,-2,1,"Restricted, Weak"
19+
5,AA Battery,"Fore, Aft, Port, Starboard","1""","2""","3""","5""",1,-,-,Local 1
20+
5,Port Torpedoes,Port,"2""","5""","7""","10""",2,-,3,Devastating
21+
5,Starboard Torpedeos,Starboard,"2""","5""","7""","10""",2,-,3,Devastating
22+
6,Light Guns (1 x 4-inch),"Aft, Port, Starboard","3""","6""","9""","12""",1,-2,1,"Slow-Loading, Weak"
23+
6,AA Battery,"Fore, Aft, Port, Starboard",-,-,-,-,-,-,-,Local 1
24+
7,Light Guns (1 x 5-inch),"Aft, Port, Startboard","4""","8""","12""","16""",1,-2,1,"Slow-Loading, Weak"
25+
7,AA Battery,"Fore, Aft, Port, Starboard",-,-,-,-,-,-,-,Local 1
26+
8,Light Guns (4 x 4.7-inch),"Fore, Aft, Port, Starboard","4""","8""","12""","16""",2,-2,1,"Restricted, Weak"
27+
8,AA Battery,"Fore, Aft, Port, Starboard",-,-,-,-,-,-,-,Local 1
28+
9,Light Guns (1 x 4-inch),"Aft, Port, Starboard","3""","6""","9""","12""",1,-2,1,"Slow-Loading, Weak"
29+
10,Light Guns (1 x 4-inch),"Aft, Port, Starboard","3""","6""","9""","12""",1,-2,1,"Slow-Loading, Weak"
30+
10,AA Battery,"Fore, Aft, Port, Starboard",-,-,-,-,-,-,-,Local 1
31+
11,Light Guns (1 x 5-inch),"Aft, Port, Starboard","4""","9""","13""","18""",1,-2,1,"DP, Slow-Loading, Weak"
32+
11,AA Battery,"Fore, Aft, Port, Starboard","1""","3""","4""","6""",1,-,-,Local 1

0 commit comments

Comments
 (0)