Robert Carnecky 10 лет назад
Родитель
Сommit
5ec5016949
3 измененных файлов: 45 добавлений и 9 удалений
  1. 30
    0
      generator/components-test.html
  2. 9
    4
      generator/generate.html
  3. 6
    5
      generator/js/ui.ts

+ 30
- 0
generator/components-test.html Просмотреть файл

@@ -6,6 +6,10 @@
6 6
     <link rel="import" href="components/card.html">
7 7
     <style type="text/css">
8 8
 
9
+        rpg-card {
10
+            margin: 4px;
11
+        }
12
+
9 13
         body {
10 14
             display: flex;
11 15
             flex-direction: column;
@@ -70,6 +74,32 @@
70 74
                 <card-description><p>+1d6 damage for each slot above 1st</p></card-description>
71 75
             </card-contents>
72 76
         </rpg-card>
77
+        <rpg-card class="card-size-25x35" color="maroon">
78
+            <card-title>
79
+                <h1>Burning Hands</h1>
80
+            </card-title>
81
+            <card-contents>
82
+                <card-subtitle>1st level evocation</card-subtitle>
83
+                <card-rule></card-rule>
84
+                <card-fill size="1"></card-fill>
85
+                <card-description>
86
+                    <h4>Mechanics</h4>
87
+                    <p>Each creature in a 15-foot cone must make a Dexterity saving throw. A creature takes <b>3d6 fire damage</b> on a failed save, or half as much damage on a successful one.</p>
88
+                </card-description>
89
+                <card-description>
90
+                    <h4>Ignite</h4>
91
+                    <p>The fire ignites any flammable objects in the area that aren't being worn or carried.</p>
92
+                </card-description>
93
+                <card-fill size="2"></card-fill>
94
+                <card-section>At higher levels</card-section>
95
+                <card-description><p>+1d6 damage for each slot above 1st</p></card-description>
96
+            </card-contents>
97
+            <card-title>
98
+                <card-icon src="/icons/gears.svg" style="float: left"></card-icon>
99
+                <h1 style="text-align: center;">Evocation 1</h1>
100
+                <card-icon src="/icons/stopwatch.svg"></card-icon>
101
+            </card-title>
102
+        </rpg-card>
73 103
         <rpg-card class="card-size-25x35" color="saddlebrown">
74 104
             <card-title>
75 105
                 <h1>Brown bear</h1>

+ 9
- 4
generator/generate.html Просмотреть файл

@@ -19,7 +19,6 @@
19 19
     <script type="text/javascript" defer src="js/ui.js"></script>
20 20
     <!-- CSS -->
21 21
     <link href="css/ui.css" rel="stylesheet" />
22
-    <link href="css/card-size.css" rel="stylesheet" />
23 22
     <!-- Components -->
24 23
     <link rel="import" href="components/card.html">
25 24
 </head>
@@ -428,13 +427,19 @@ else {
428 427
                     </p>
429 428
                     <textarea class="form-control" rows="10" id="filter-function" wrap="off">
430 429
 // Color all spell cards yellow
431
-if (card_has_tag(card, "spell")) {
430
+if (card.hasTag("spell")) {
432 431
     card.color = "yellow";
433 432
 }
434 433
 
435 434
 // Remove all creature cards
436
-if (card_has_tag(card, "creature")) {
437
-    return false;
435
+if (card.hasTag("creature")) {
436
+    deck.deleteCard(card);
437
+}
438
+
439
+// Duplicate all consumable item cards
440
+if (card.hasTag("item") && card.hasTag("consumable")) {
441
+    var newCard = deck.duplicateCard(card);
442
+    newCard.color = "pink";
438 443
 }
439 444
                     </textarea>
440 445
                 </div>

+ 6
- 5
generator/js/ui.ts Просмотреть файл

@@ -61,6 +61,7 @@ module RpgCardsUI {
61 61
         if (card) {
62 62
             $("#card-title").val(card.title);
63 63
             $("#card-title-size").val(card.title_size);
64
+            $("#card-title-icon-text").val(card.title_icon_text);
64 65
             $("#card-count").val(""+card.count);
65 66
             $("#card-icon").val(card.icon);
66 67
             $("#card-icon-back").val(card.icon_back);
@@ -70,6 +71,7 @@ module RpgCardsUI {
70 71
         } else {
71 72
             $("#card-title").val("");
72 73
             $("#card-title-size").val("");
74
+            $("#card-title-icon-text").val("");
73 75
             $("#card-count").val("1");
74 76
             $("#card-icon").val("");
75 77
             $("#card-icon-back").val("");
@@ -317,13 +319,12 @@ module RpgCardsUI {
317 319
         hideModal("#filter-modal");
318 320
 
319 321
         var fn_code = $("#filter-function").val();
320
-        var fn = new Function("card", fn_code);
322
+        var fn = new Function("card", "deck", fn_code);
321 323
 
322
-        deck.cards = deck.cards.filter(function (card) {
323
-            var result = fn(card);
324
-            if (result === undefined) return true;
325
-            else return result;
324
+        deck.cards.forEach((card) => {
325
+            fn(card, deck);
326 326
         });
327
+        deck.commit();
327 328
 
328 329
         update_card_list();
329 330
     }

Загрузка…
Отмена
Сохранить