From 1474e9227e38c00060d1f1114f5768fa0bc33d76 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 25 Feb 2017 07:33:56 +1100 Subject: [PATCH] Set up a small website for Mecha Game's rules --- .gitignore | 4 ++ public_html/card_concepts.csv | 11 ++++ public_html/cards.csv | 26 ++++++++ public_html/feedback.html | 38 ++++++++++++ public_html/index.html | 47 +++++++++++++++ public_html/package.json | 14 +++++ public_html/rules.md | 85 ++++++++++++++++++++++++++ public_html/styles/shared.css | 42 +++++++++++++ public_html/submit.cgi | 28 +++++++++ public_html/tsorter.min.js | 6 ++ public_html/utilities.js | 108 ++++++++++++++++++++++++++++++++++ 11 files changed, 409 insertions(+) create mode 100644 .gitignore create mode 100644 public_html/card_concepts.csv create mode 100644 public_html/cards.csv create mode 100644 public_html/feedback.html create mode 100644 public_html/index.html create mode 100644 public_html/package.json create mode 100644 public_html/rules.md create mode 100644 public_html/styles/shared.css create mode 100755 public_html/submit.cgi create mode 100644 public_html/tsorter.min.js create mode 100644 public_html/utilities.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2fc0de4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +#directories +logs/** +/**/node_modules +output.js diff --git a/public_html/card_concepts.csv b/public_html/card_concepts.csv new file mode 100644 index 0000000..2b46be1 --- /dev/null +++ b/public_html/card_concepts.csv @@ -0,0 +1,11 @@ +Card Name;Cost;Type;Effect / Reminder Text;Power;Durability +EMP Blast;;Command;Destroy all towers (including mecha towers).;; +Radio Silence;;Command;Destroy all towers (including mecha towers). Each player reveals their hands and discards all towers (including mecha towers).;; +Cruiser;2;Mecha;Haste (this mecha can move and attack on the same turn it's played).;2;2 +Cruise Missle;1;Mecha;After this mecha attacks, destroy it.;4;1 +Drone Strike;;Trigger Command;Deal 2 damage to any target unit (including radio towers).;; +Sabotage;;Command;Sacrifice a tower you control. Destroy one target mecha.;; +Heavy Fire;;Command;Remove all Armour counters from target mecha.;; +Preparations;;Command;You may start the game with this card in your hand. Destroy one target mecha.;; +Reparations;;Command;If a mecha you control is destroyed, destroy target mecha.;; +Mortar Rain;;Command;Destroy target Mecha.;; diff --git a/public_html/cards.csv b/public_html/cards.csv new file mode 100644 index 0000000..6025c6f --- /dev/null +++ b/public_html/cards.csv @@ -0,0 +1,26 @@ +Card Name;Cost;Type;Effect / Reminder Text;Power;Durability +Radio Tower;;Basic Tower;Provides 1u (1 unit of bandwidth. Play only one Tower card each turn).;;2 +Radio Relay;2;Mecha Tower;(Radio Relay counts as a Mecha and a Tower. Play only one Tower card each turn.) Play this card only on a space with a Radio Tower. Destroy that tower. Provides 1u for each unit you control named Radio Relay (1 unit of bandwidth).;0;2 +Attack Vector;2;Mecha;(No abilities.);2;1 +Mega Bot;3;Mecha;(No abilities.);3;2 +Class Ganon;3;Mecha;(No abilities.);4;1 +Mod Bot;2;Mecha;Sacrifice a neighbouring mecha you control: add that unit's durability to this mecha.;1;2 +Cap Gun;1;Mecha;Pierce (This unit ignores Armour counters). Reach (This unit may attack units with flight).;1;1 +Shortbow;1;Mecha;Pierce (This unit ignores Armour counters). Range 2 (This unit may attack any unit within two spaces).;1;1 +Longbow;2;Mecha;Pierce (This unit ignores Armour counters). Range 3 (This unit may attack any unit within three spaces).;1;1 +Bot-a-pult;2;Mecha;Reach (This unit may attack units with flight). Sacrifice a neighbouring mecha you control: this mecha gains Range 3 this turn (This unit may attack any unit within three spaces this turn).;2;2 +Stonewall;1;Mecha;This mecha can't attack. When this mecha moves it can't move next turn.;0;6 +Turtle;2;Mecha;Armour 1 (This unit enters the battlefield with one Armour counter. If it would take damage while it has any Armour counters, prevent that damage and remove an Armour counter). This mecha may not attack and move in the same turn.;2;3 +Dragon;4;Mecha;Armour 2 (This unit enters the battlefield with two Armour counters. If it would take damage while it has any Armour counters, prevent that damage and remove an Armour counter). This mecha may not attack and move in the same turn.;4;4 +Jager;6;Mecha;Armour 3 (This unit enters the battlefield with three Armour counters. If it would take damage while it has any Armour counters, prevent that damage and remove an Armour counter). Reach (This unit may attack units with flight).;6;6 +Insect Drone;2;Mecha;Flight (This unit can't be attacked except by units with flight or reach).;1;1 +Wasp Drone;3;Mecha;Flight (This unit can't be attacked except by units with flight or reach). When this mecha attacks, the target can't attack next turn.;1;1 +Magpie Drone;3;Mecha;Flight (This unit can't be attacked except by units with flight or reach). When this mecha attacks, the target must move next turn if possible.;1;1 +Attack Orders;;Command;One mecha you control can attack an extra time this turn.;; +Marching Orders;;Command;One mecha you control can move an extra space this turn.;; +Ramp Orders;;Command;One mecha you control gains Reach this turn (That unit may attack units with flight).;; +Virus;;Command;Sacrifice a Tower you control. If you do, one mecha an opponent controls can't attack this turn.;; +Tunnel Warfare;;Command;Discard another card from your hand. If you do, any one mecha you control can move an extra space this turn.;; +Road Works;;Command;Play this card on the battlefield with 2 time counters on it (Remove one time counter at the beginning of each turn). At the beginning of your main phase, if there are no time counters on this card, neighbouring mechas gain Speed 3 this turn (those unit may move up to three spaces this turn).;; +Espionage;;Command;Look at any one player's hand, then draw a card.;; +Ironhide;;Command;Put two Armour counters on any one mecha in your entry zone (If a unit would take damage while it has any Armour counters, prevent that damage and remove an Armour counter).;; diff --git a/public_html/feedback.html b/public_html/feedback.html new file mode 100644 index 0000000..c9d7044 --- /dev/null +++ b/public_html/feedback.html @@ -0,0 +1,38 @@ + + +

If you have an idea for a card, a rule, or some other feedback (encouragement is greatly appreciated!) please let me know below!

+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ diff --git a/public_html/index.html b/public_html/index.html new file mode 100644 index 0000000..ca7df57 --- /dev/null +++ b/public_html/index.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + +
+ +

Mecha Game Rules

+
+ + +
+ + + + +
+ + +
+ + + + + + + + diff --git a/public_html/package.json b/public_html/package.json new file mode 100644 index 0000000..380b7d0 --- /dev/null +++ b/public_html/package.json @@ -0,0 +1,14 @@ +{ + "name": "public_html", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "markdown": "^0.5.0" + } +} diff --git a/public_html/rules.md b/public_html/rules.md new file mode 100644 index 0000000..ca098be --- /dev/null +++ b/public_html/rules.md @@ -0,0 +1,85 @@ +These are the official rules for Mecha Game. Anything not found on this website is considered a non-standard variant. + +Basic Rules +=== + +The game takes place on a 5*7 grid, (wider than it is long). Players start the game with a deck of 40 cards, with no more than 3 copies of any one card (based on the card's name). Players draw 5 cards, then take turns by placing certain cards (see below) on the closest row of the board, known as their entry zone. If there are no empty spaces in a player's entry zone (excluding movable units that player owns), then the player cannot play a new card and loses the game. A player also loses the game if they cannot draw a card from their deck. + +The goal of the game is to attack your opponent directly five times. Each time a player is attacked directly by a mecha, they place the top card of their deck in the damage zone. Once there are five cards in a player's damage zone, that player loses the game. + +Tower cards generally cannot move, but provide “bandwidth”, which can be used to play Mecha cards (see below). A player may have any number of cards named Radio Tower in their deck. + +Mechas are cards which act as playing pieces. A mecha card has three numbers down the side: their cost, their power and their durability. Players can play as many mechas as they want, as long as the mecha's total cost does not exceed their current bandwidth. If enough towers are destroyed that the bandwidth drops below the current population, then nothing special happens; the player simply can't play any more mechas until enough bandwidth is available. Mechas may only move one orthogonal space at a time. If a mecha can move more than one space, such as with the “speed” ability, then they must move along each space one at a time, and they cannot pass through other mechas or towers. + +Command cards are cards with miscellaneous abilities, and they can be played at any time. + +When combat between mechas is initiated, the attacker's power is subtracted from the defender's durability. When a mecha's durability reaches zero, it is destroyed and discarded. + +Phases of a Turn +=== + +* Start Phase (Do nothing unless told otherwise) +* Draw Phase (Draw a card) +* Main Phase (Play cards, move, attack, etc) +* End Phase (Do nothing unless told otherwise) + +Types of Counters +=== + +Various cards on the battlefield may have different types of “counters” on them. These counters mark various properties as listed below. + +Durability +--- + +Durability counters represent how much damage a unit can take before being destroyed. When a unit enters the battlefield, they begin with a number of durability counters equal to their base durability. When another unit attacks with a power of X, then you remove X durability counters from this unit. When the number of durability counters on any unit drops to zero, the unit is destroyed and discarded. + +Armour +--- + +Armour counters protect a unit's durability. Each time a unit is attacked, if it has armour counters, remove one armour counter instead of any durability counters. Therefore, a unit with two armour counters can be attacked twice before taking damage. + +Time +--- + +Time counters represent the amount of time remaining before some action takes place. If a permanent you control has a time counter at the beginning of your turn, then remove one time counter. + +List of Keyword Mechanics +=== + +A keyword is a word or phrase listed below which appear on cards to indicate a commonly used game mechanic. Some keywords are followed by an “X”, which represents a number used by that mechanic. For example, Armour 2 means that the mecha enters the battlefield with 2 armour counters on it. Multiple instances of certain keywords stack. + +Armour X +--- + +If a permanent has the Armour ability, then it enters the battlefield with X Armour counters. Remove one Armour counter each time that permanent is attacked rather than having that permanent take damage. + +Pierce +--- + +Pierce is the opposite of Armour, allowing an attacker to ignore Armour counters. Instead of removing an Armour counter from the target of an attack, remove durability counters as normal. + +Flight +--- + +Flight represents units with some kind of areal movement. They cannot be attacked by other units unless the attacker also has Flight or Reach. + +Reach +--- + +Reach Allows you to attack units with Flight. + +Speed X +--- + +Speed represents the distance a unit can move. All units normally have a movement distance of 1, but a unit with Speed 3 can move up to three spaces in a turn, one at a time. They can also change direction mid-travel. + +Range X +--- + +Range represents the distance that a unit can attack. Normally, a unit can only attack neighbouring units, but an attacker with Range can attack up to X spaces away. When counting spaces for Range, count in orthogonal directions only; therefore attacking diagonally requires Range 2. Range allows a mecha to fire "over the top of" friendly units, but not enemy units; do this by ignoring friendly units when counting the distance to a target. + +Provide Xu +--- + +Not strictly a keyword, but Towers usually provide a number of units ('u' for short) towards your total bandwidth. + diff --git a/public_html/styles/shared.css b/public_html/styles/shared.css new file mode 100644 index 0000000..60215f8 --- /dev/null +++ b/public_html/styles/shared.css @@ -0,0 +1,42 @@ +body { + display: flex; + min-height: 100vh; + flex-direction: column; +} + +#content { + margin-top: 1rem; + margin-bottom: 1rem; + flex: 1; +} + +h1 { + font-size: 24px; + font-weight: bold; +} + +h2 { + font-size: 16px; + font-weight: bold; +} + +p { + font-size: 14px; +} + +thead { + font-weight: bold; +} + +footer { + text-align: center; +} + +/* Up and Down Arrows */ +.descend:after{ + content: "\25B2"; +} + +.ascend:after{ + content: "\25BC"; +} diff --git a/public_html/submit.cgi b/public_html/submit.cgi new file mode 100755 index 0000000..ab2dfd6 --- /dev/null +++ b/public_html/submit.cgi @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use CGI ':standard'; +use Email::MIME; +use Email::Sender::Simple 'sendmail'; + +$CGI::LIST_CONTEXT_WARN = 0; + +my $feedback = escapeHTML(CGI::param('feedback')); + +my $message = Email::MIME->create(); + +$message->header_str_set(From => 'no-reply@krgamestudios.com'); +$message->header_str_set(To => 'kayneruse@gmail.com'); +$message->header_str_set(Subject => 'Mecha Feedback'); + +$message->encoding_set('quoted-printable'); +$message->charset_set('UTF-8'); + +$message->body_set($feedback); + +sendmail($message); + +print "Content-type: text/html\n\n"; +print "

Thank you for your feedback!!

"; diff --git a/public_html/tsorter.min.js b/public_html/tsorter.min.js new file mode 100644 index 0000000..43ec3c4 --- /dev/null +++ b/public_html/tsorter.min.js @@ -0,0 +1,6 @@ +/*! + * tsorter 2.0.0 - Copyright 2015 Terrill Dent, http://terrill.ca + * JavaScript HTML Table Sorter + * Released under MIT license, http://terrill.ca/sorting/tsorter/LICENSE + */ +var tsorter=function(){"use strict";var a,b,c,d=!!document.addEventListener;return Object.create||(Object.create=function(a){var b=function(){return void 0};return b.prototype=a,new b}),b=function(a,b,c){d?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},c=function(a,b,c){d?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c)},a={getCell:function(a){var b=this;return b.trs[a].cells[b.column]},sort:function(a){var b=this,c=a.target;b.column=c.cellIndex,b.get=b.getAccessor(c.getAttribute("data-tsorter")),b.prevCol===b.column?(c.className="ascend"!==c.className?"ascend":"descend",b.reverseTable()):(c.className="ascend",-1!==b.prevCol&&"exc_cell"!==b.ths[b.prevCol].className&&(b.ths[b.prevCol].className=""),b.quicksort(0,b.trs.length)),b.prevCol=b.column},getAccessor:function(a){var b=this,c=b.accessors;if(c&&c[a])return c[a];switch(a){case"link":return function(a){return b.getCell(a).firstChild.firstChild.nodeValue};case"input":return function(a){return b.getCell(a).firstChild.value};case"numeric":return function(a){return parseFloat(b.getCell(a).firstChild.nodeValue,10)};default:return function(a){return b.getCell(a).firstChild.nodeValue}}},exchange:function(a,b){var c,d=this,e=d.tbody,f=d.trs;a===b+1?e.insertBefore(f[a],f[b]):b===a+1?e.insertBefore(f[b],f[a]):(c=e.replaceChild(f[a],f[b]),f[a]?e.insertBefore(c,f[a]):e.appendChild(c))},reverseTable:function(){var a,b=this;for(a=1;a=b)){if(b-a===2)return void(f.get(b-1)>f.get(a)&&f.exchange(b-1,a));for(c=a+1,d=b-1,f.get(a)>f.get(c)&&f.exchange(c,a),f.get(d)>f.get(a)&&f.exchange(a,d),f.get(a)>f.get(c)&&f.exchange(c,a),e=f.get(a);;){for(d--;e>f.get(d);)d--;for(c++;f.get(c)>e;)c++;if(c>=d)break;f.exchange(c,d)}f.exchange(a,d),b-d>d-a?(f.quicksort(a,d),f.quicksort(d+1,b)):(f.quicksort(d+1,b),f.quicksort(a,d))}},init:function(a,c,d){var e,f=this;for("string"==typeof a&&(a=document.getElementById(a)),f.table=a,f.ths=a.getElementsByTagName("th"),f.tbody=a.tBodies[0],f.trs=f.tbody.getElementsByTagName("tr"),f.prevCol=c&&c>0?c:-1,f.accessors=d,f.boundSort=f.sort.bind(f),e=0;e