Initial commit

This commit is contained in:
WatermelonModders
2022-05-31 12:35:46 -04:00
commit fc5cb0c32c
4097 changed files with 447075 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
@section
buff:code,target
battlecry:code,target
defender:code
properties:all,levelup
spell_aoe:code,target
spell:code,target
attack:code,target
attack_effect:code
weapon:code
endturn:code
onboard:code
destroyed:code
weapon_destroyed:code
idle:code
weapon_attack:code
attachment_attack:code
attack_effect_attachment:code
@@ -0,0 +1,14 @@
# Goldshire Footman
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
},
".section properties" : {
"all": [ "taunt" ]
}
}
@@ -0,0 +1,23 @@
# Holy Nova
{
".section spell_aoe" : {
"code" : "
def(card_list_s, allcards)
allcards = hsl_board_all_cards($attacker, $heroes_included);
def(card_list_s, cl)
foreach(cl, allcards) {
if(cl->card->controller == $attacker->controller) {
cl->card->receive.heal = 2;
} else {
cl->card->receive.damage = 2;
}
}
hsl_attack_aoe($attacker, allcards)
hsl_link_target($attacker, allcards)
",
"target": "$auto"
}
}
@@ -0,0 +1,11 @@
# Holy Smite
{
".section spell" : {
"code" : "
$defender->receive.damage = 2;
hsl_attack($attacker, $defenders);
",
"target": "$all"
}
}
@@ -0,0 +1,13 @@
# Mind Vision
{
".section buff" : {
"code": "
def(card_s, card)
card = hsl_cards_get_hand_random($deck_opponent);
if(card) {
hsl_add_new_card_hand($deck_player, card->entity->name, holder)
}
",
"target" : "$auto"
}
}
@@ -0,0 +1,15 @@
# Power Word: Shield
{
".section buff" : {
"code": "
hsl_change_health($defender, 2)
hsl_add_signle_attachment($player, $deck_player, $attacker, $defender);
hsl_draw_cards($player, $deck_player, draw_card, 1)
/* hsl_link_target($attacker, $defenders) */
",
"target": "$minions"
}
}
@@ -0,0 +1,14 @@
# Claw
{
".section buff" : {
"code": "
int change = 2;
hsl_buff_attack_expire(1, $ally_hero, change);
hsl_change_armor($ally_hero, change)
hsl_add_attachment($player, $attacker, $ally_hero, 1);
hsl_add_target($ally_hero, holder)
",
"target": "$auto"
}
}
@@ -0,0 +1,12 @@
# Healing Touch
{
".section buff" : {
"code" : "
$defender->receive.heal = 8;
hsl_attack($attacker, $defenders);
hsl_link_target($attacker, $defenders);
",
"target": "$all"
}
}
@@ -0,0 +1,12 @@
# Moonfire
{
".section spell" : {
"code" : "
/* defender is linked by default */
$defender->receive.damage = 1;
hsl_attack($attacker, $defenders);
",
"target": "$all"
}
}
@@ -0,0 +1,12 @@
# Mark of the Wild
{
".section buff" : {
"code": "
hsl_change_attack($defender, 2)
hsl_set_taunt($defender)
hsl_add_signle_attachment($player, $deck_player, $attacker, $defender);
",
"target": "$minions"
}
}
@@ -0,0 +1,18 @@
# Savage Roar
{
".section buff" : {
"code": "
def(card_list_s, all)
all = hsl_board_friendly_cards($attacker, $heroes_included);
def(card_list_s, itm)
foreach(itm, all) {
hsl_buff_attack_expire(1, itm->card, 2);
hsl_add_attachment($player, $attacker, itm->card, 1);
hsl_add_defender(itm->card, holder)
}
",
"target": "$auto"
}
}
@@ -0,0 +1,21 @@
# Swipe
{
".section spell_aoe" : {
"code": "
def(card_list_s, all)
all = hsl_board_enemy_cards($defender, $heroes_included);
$defender->receive.damage = 4;
def(card_list_s, itm)
foreach(itm, all) {
itm->card->receive.damage = 1;
hsl_add_target(itm->card, holder);
}
hsl_attack($attacker, $defenders)
",
"target": "$enemy"
}
}
@@ -0,0 +1,10 @@
# Polymorph
{
".section buff" : {
"code": "
hsl_transform($attacker, $defender, \"CS2_tk1\");
",
"target": "$enemy_minions"
}
}
@@ -0,0 +1,9 @@
# Arcane Intellect
{
".section buff" : {
"code": "
hsl_draw_cards($player, $deck_player, draw_card, 2)
",
"target" : "$auto"
}
}
@@ -0,0 +1,22 @@
# Frostbolt
{
".section spell" : {
"code" : "
$defender->receive.damage = 3;
hsl_attack($attacker, $defenders);
",
"target": "$all"
},
".section attack_effect" : {
"code" : "
hsl_freeze($attacker, $defender)
"
},
".section properties" : {
"all": [ "freeze" ]
}
}
@@ -0,0 +1,19 @@
# Arcane Explosion
{
".section spell_aoe" : {
"code" : "
def(card_list_s, e)
e = hsl_board_enemy_cards($attacker, $heroes_excluded);
def(card_list_s, cl)
foreach(cl, e) {
cl->card->receive.damage = 1;
}
hsl_attack_aoe($attacker, e)
hsl_link_target($attacker, e)
",
"target": "$auto"
}
}
@@ -0,0 +1,15 @@
# Frost Nova
{
".section spell_aoe" : {
"code" : "
def(card_list_s, e)
e = hsl_board_enemy_cards($attacker, $heroes_excluded);
hsl_attack_aoe($attacker, e)
hsl_link_target($attacker, e)
",
"target": "$auto"
}
}
@@ -0,0 +1,17 @@
# Mirror Image
{
".section spell_aoe" : {
"code": "
int i;
for(i = 0; i < 2; i++) {
hsl_summon_card($deck_player, \"CS2_mirror\", cardholder)
}
/* this just does the routine (destroying it etc..) with a played card */
hsl_attack_aoe($attacker, $defenders)
",
"target": "$auto"
}
}
@@ -0,0 +1,12 @@
# Fireball
{
".section spell" : {
"code" : "
$defender->receive.damage = 6;
hsl_attack($attacker, $defenders);
",
"target": "$all"
}
}
@@ -0,0 +1,19 @@
# Flamestrike
{
".section spell_aoe" : {
"code" : "
def(card_list_s, e)
e = hsl_board_enemy_cards($attacker, $heroes_excluded);
def(card_list_s, cl)
foreach(cl, e) {
cl->card->receive.damage = 4;
}
hsl_attack_aoe($attacker, e)
hsl_link_target($attacker, e)
",
"target": "$auto"
}
}
@@ -0,0 +1,21 @@
# Water Elemental
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
},
".section attack_effect" : {
"code" : "
hsl_freeze($attacker, $defender)
"
},
".section properties" : {
"all": [ "freeze" ]
}
}
@@ -0,0 +1,22 @@
# Frost Shock
{
".section spell" : {
"code" : "
$defender->receive.damage = 1;
hsl_attack($attacker, $defenders);
",
"target": "$all"
},
".section attack_effect" : {
"code" : "
hsl_freeze($attacker, $defender)
"
},
".section properties" : {
"all": [ "freeze" ]
}
}
@@ -0,0 +1,10 @@
# Windfury
{
".section buff" : {
"code": "
setflag($defender, CARD_WINDFURY)
",
"target": "$minions"
}
}
@@ -0,0 +1,12 @@
# Ancestral Healing
{
".section buff" : {
"code": "
hsl_set_fullhealth($defender)
hsl_set_taunt($defender)
",
"target": "$minions"
}
}
@@ -0,0 +1,14 @@
# Fire Elemental
{
".section battlecry" : {
"code" : "
def(card_s, def)
def = hsl_card($target);
if(def) {
hsl_attack_bc($attacker, def, 3)
}
",
"target": "$all"
}
}
@@ -0,0 +1,12 @@
# Rockbiter Weapon
{
".section buff" : {
"code": "
hsl_buff_attack_expire(1, $defender, 3);
hsl_add_attachment($player, $attacker, $defender, 1);
",
"target": "$auto"
}
}
@@ -0,0 +1,17 @@
# Bloodlust
{
".section buff" : {
"code": "
def(card_list_s, all)
all = hsl_board_friendly_cards($attacker, $heroes_excluded)
def(card_list_s, itm)
foreach(itm, all) {
hsl_buff_attack_expire(1, itm->card, 3);
hsl_add_attachment($player, $attacker, itm->card, 1);
}
",
"target": "$auto"
}
}
@@ -0,0 +1,11 @@
# Shadow Bolt
{
".section spell" : {
"code" : "
$defender->receive.damage = 4;
hsl_attack($attacker, $defenders);
",
"target": "$minions"
}
}
@@ -0,0 +1,16 @@
# Drain Life
{
".section spell_aoe" : {
"code": "
hsl_receive_damage($defender, 2);
hsl_receive_heal($ally_hero, 2);
hsl_add_target($ally_hero, holder);
hsl_attack($attacker, $defenders)
",
"target": "$enemy"
}
}
@@ -0,0 +1,20 @@
# Hellfire
{
".section spell_aoe" : {
"code" : "
def(card_list_s, allcards)
allcards = hsl_board_all_cards($attacker, $heroes_included);
def(card_list_s, cl)
foreach(cl, allcards) {
cl->card->receive.damage = 3;
}
hsl_attack_aoe($attacker, allcards)
hsl_link_target($attacker, allcards)
",
"target": "$auto"
}
}
@@ -0,0 +1,11 @@
# Corruption
{
".section buff" : {
"code": "
hsl_buff_corrupt_expire(2, $defender);
hsl_add_attachment($player, $attacker, $defender, 2);
",
"target": "$minions"
}
}
@@ -0,0 +1,20 @@
# Dread Infernal
{
".section battlecry" : {
"code" : "
def(card_list_s, allcards)
allcards = hsl_board_all_cards($attacker, $heroes_included);
def(card_list_s, cl)
foreach(cl, allcards) {
cl->card->receive.damage = 1;
}
hsl_attack_aoe(attacker, allcards)
hsl_link_target(attacker, allcards)
",
"target": "$auto"
}
}
@@ -0,0 +1,15 @@
# Voidwalker
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
},
".section properties" : {
"all": [ "taunt" ]
}
}
@@ -0,0 +1,11 @@
# Backstab
{
".section spell" : {
"code" : "
hsl_receive_damage($defender, 2);
hsl_attack($attacker, $defenders);
",
"target": "$undamaged_minions"
}
}
@@ -0,0 +1,11 @@
# Sinister Strike
{
".section battlecry" : {
"code" : "
hsl_attack_bc($attacker, $enemy_hero, 3)
",
"target": "$auto"
}
}
@@ -0,0 +1,10 @@
# Assassinate
{
".section buff" : {
"code" : "
hsl_destroy($defender);
",
"target": "$enemy_minions"
}
}
@@ -0,0 +1,9 @@
# Sprint
{
".section buff" : {
"code": "
hsl_draw_cards($player, $deck_player, draw_card, 4)
",
"target" : "$auto"
}
}
@@ -0,0 +1,9 @@
# Assassin's Blade
{
".section weapon" : {
"code" : "
hsl_give_weapon($deck_player);
"
}
}
@@ -0,0 +1,8 @@
# Wicked Knife
{
".section weapon" : {
"code" : "
hsl_give_weapon($deck_player);
"
}
}
@@ -0,0 +1,12 @@
# Blessing of Might
{
".section buff" : {
"code": "
hsl_change_attack($defender, 3)
hsl_add_signle_attachment($player, $deck_player, $attacker, $defender);
",
"target": "$minions"
}
}
@@ -0,0 +1,10 @@
# Guardian of Kings
{
".section battlecry" : {
"code" : "
hsl_heal($attacker, $ally_hero, 6)
",
"target": "$auto"
}
}
@@ -0,0 +1,13 @@
# Holy Light
{
".section buff" : {
"code" : "
$defender->receive.heal = 6;
hsl_attack($attacker, $defenders);
hsl_link_target($attacker, $defenders);
",
"target": "$all"
}
}
@@ -0,0 +1,9 @@
# Light's Justice
{
".section weapon" : {
"code" : "
hsl_give_weapon($deck_player);
"
}
}
@@ -0,0 +1,12 @@
# Blessing of Kings
{
".section buff" : {
"code": "
hsl_change_attack($defender, 4)
hsl_change_health($defender, 4)
hsl_add_signle_attachment($player, $deck_player, $attacker, $defender);
",
"target": "$minions"
}
}
@@ -0,0 +1,18 @@
# Consecration
{
".section spell_aoe" : {
"code" : "
def(card_list_s, e)
e = hsl_board_enemy_cards($attacker, $heroes_included);
def(card_list_s, cl)
foreach(cl, e) {
cl->card->receive.damage = 2;
}
hsl_attack_aoe($attacker, e)
hsl_link_target($attacker, e)
",
"target": "$auto"
}
}
@@ -0,0 +1,13 @@
# Hammer of Wrath
{
".section spell" : {
"code" : "
$defender->receive.damage = 3;
hsl_attack($attacker, $defenders);
hsl_draw_cards($player, $deck_player, draw_card, 1)
",
"target": "$all"
}
}
@@ -0,0 +1,11 @@
# Heroic Strike
{
".section buff" : {
"code": "
hsl_buff_attack_expire(1, $ally_hero, 4);
hsl_add_attachment($player, $attacker, $ally_hero, 1);
",
"target": "$auto"
}
}
@@ -0,0 +1,8 @@
# Fiery War Axe
{
".section weapon" : {
"code" : "
hsl_give_weapon($deck_player);
"
}
}
@@ -0,0 +1,10 @@
# Execute
{
".section buff" : {
"code" : "
hsl_destroy($defender);
",
"target": "$damaged_minions"
}
}
@@ -0,0 +1,9 @@
# Arcanite Reaper
{
".section weapon" : {
"code" : "
hsl_give_weapon($deck_player);
"
}
}
@@ -0,0 +1,10 @@
# Magma Rager
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
}
}
@@ -0,0 +1,14 @@
# Ironforge Rifleman
{
".section battlecry" : {
"code" : "
def(card_s, def)
def = hsl_card($target);
if(def) {
hsl_attack_bc($attacker, def, 1)
}
",
"target": "$all"
}
}
@@ -0,0 +1,11 @@
# Kobold Geomancer
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
}
}
@@ -0,0 +1,10 @@
# Bloodfen Raptor
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
}
}
@@ -0,0 +1,10 @@
# Razorfen Hunter
{
".section battlecry" : {
"code" : "
hsl_summon_card($deck_player, \"CS2_boar\", cardholder)
",
"target" : "$auto"
}
}
@@ -0,0 +1,11 @@
# Stormwind Champion
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
}
}
@@ -0,0 +1,16 @@
# Frostwolf Warlord
{
".section battlecry" : {
"code" : "
int num_minions = hsl_board_minions_count($deck_player, $attacker);
if(num_minions > 0) {
hsl_change_health($attacker, num_minions)
hsl_change_attack($attacker, num_minions)
hsl_add_signle_attachment($player, $deck_player, $attacker, $attacker);
}
",
"target": "$auto"
}
}
@@ -0,0 +1,10 @@
# Shadow Word: Pain
{
".section buff" : {
"code" : "
hsl_destroy($defender);
",
"target": "$attack3less_minions"
}
}
@@ -0,0 +1,10 @@
# Divine Spirit
{
".section buff" : {
"code": "
buff_health($defender, $defender->health * 2);
",
"target": "$minions"
}
}
@@ -0,0 +1,14 @@
# Mirror Image
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
},
".section properties" : {
"all": [ "taunt" ]
}
}
@@ -0,0 +1,10 @@
# Sheep
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
}
}
@@ -0,0 +1,20 @@
# Darkscale Healer
{
".section battlecry" : {
"code" : "
def(card_list_s, allcards)
allcards = hsl_board_friendly_cards($attacker, $heroes_included);
def(card_list_s, cl)
foreach(cl, allcards) {
cl->card->receive.heal = 2;
}
hsl_attack_aoe(attacker, allcards)
hsl_link_target(attacker, allcards)
",
"target": "$auto"
}
}
@@ -0,0 +1,10 @@
# Novice Engineer
{
".section battlecry" : {
"code" : "
hsl_draw_cards($player, $deck_player, draw_card, 1)
",
"target": "$auto"
}
}
@@ -0,0 +1,14 @@
# Scarlet Crusader
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
},
".section properties" : {
"all": [ "divine_shield" ]
}
}
@@ -0,0 +1,10 @@
# Dragonling Mechanic
{
".section battlecry" : {
"code" : "
hsl_summon_card($deck_player, \"EX1_025t\", cardholder)
",
"target": "$auto"
}
}
@@ -0,0 +1,10 @@
# Acidic Swamp Ooze
{
".section battlecry" : {
"code" : "
hsl_destroy_weapon($attacker, $player, holder)
",
"target": "$auto"
}
}
@@ -0,0 +1,11 @@
# Hex
{
".section buff" : {
"code": "
hsl_transform($attacker, $defender, \"hexfrog\");
",
"target": "$enemy_minions"
}
}
@@ -0,0 +1,10 @@
# Succubus
{
".section battlecry" : {
"code" : "
hsl_discard_random_hand($deck_player, 1, holder)
",
"target": "$auto"
}
}
@@ -0,0 +1,18 @@
# Whirlwind
{
".section spell_aoe" : {
"code" : "
def(card_list_s, e)
e = hsl_board_enemy_cards($attacker, $heroes_excluded);
def(card_list_s, cl)
foreach(cl, e) {
cl->card->receive.damage = 1;
}
hsl_attack_aoe($attacker, e)
hsl_link_target($attacker, e)
",
"target": "$auto"
}
}
@@ -0,0 +1,10 @@
# Murloc Tidehunter
{
".section battlecry" : {
"code" : "
hsl_summon_card($deck_player, \"EX1_506a\", cardholder)
",
"target": "$auto"
}
}
@@ -0,0 +1,13 @@
# Sap
{
".section buff" : {
"code": "
unsetflag($defender, CARD_BOARD)
setflag($defender, CARD_HAND)
$defender->zone_position = ++($deck_opponent->handposition);
",
"target": "$enemy_minions"
}
}
@@ -0,0 +1,10 @@
# Sinister Strike
{
".section battlecry" : {
"code" : "
hsl_attack_bc($attacker, $enemy_hero, 3)
",
"target": "$auto"
}
}
@@ -0,0 +1,12 @@
# Shield Block
{
".section buff" : {
"code": "
hsl_change_armor($ally_hero, 5);
hsl_add_target($ally_hero, holder);
hsl_draw_cards($player, $deck_player, draw_card, 1)
",
"target": "$auto"
}
}
@@ -0,0 +1,12 @@
# Illidan
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
}
}
@@ -0,0 +1,11 @@
# Shadow Word: Death
{
".section buff" : {
"code" : "
hsl_destroy($defender);
",
"target": "$attack5more_minions"
}
}
@@ -0,0 +1,10 @@
# HERO_01
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$all"
}
}
@@ -0,0 +1,10 @@
# HERO_03
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$all"
}
}
@@ -0,0 +1,16 @@
# Sacrificial Pact
{
".section spell_aoe" : {
"code": "
hsl_destroy($defender);
hsl_receive_heal($ally_hero, 5);
hsl_add_target($ally_hero, holder);
hsl_attack($attacker, $defenders)
",
"target": "$demon"
}
}
@@ -0,0 +1,22 @@
# Vanish
{
".section buff" : {
"code": "
/*
def(card_list_s, itm)
foreach(itm, $defenders) {
unsetflag(itm->card, CARD_BOARD)
setflag(itm->card, CARD_HAND)
if(controller_player(itm->card)) {
itm->card->zone_position = ++($deck_player->handposition);
} else {
itm->card->zone_position = ++($deck_opponent->handposition);
}
}
*/
",
"target": "$auto"
}
}
@@ -0,0 +1,37 @@
# Healing Totem
{
".section endturn" : {
"code" : "
def(card_list_s, all);
all = hsl_board_friendly_cards_wattacker($heroes_excluded);
def(card_s, found);
def(card_list_s, c);
foreach(c, all) {
if(hsl_cmp_cardname(c, \"NEW1_009\")) {
found = c->card;
break;
}
}
if(found != NULL) {
def(card_list_s, filter);
filter = hsl_board_friendly_cards(found, $heroes_excluded);
foreach(c, filter) {
/* exclude self */
if(c->card == found) continue;
hsl_receive_heal(c->card, 1);
entity_attack(p, found, c->card);
}
found->target.card = all;
flag(&found->state, MECHANICS_TURN_TRIGGER, FLAG_SET);
}
"
}
}
@@ -0,0 +1,20 @@
# Kor'kron Elite
{
".section battlecry" : {
"code" : "
def(card_s, def)
def = hsl_card($target);
if(def) {
hsl_attack_bc($attacker, def, 1)
}
",
"target": "$auto"
},
".section defender" : {
"code" : "
hsl_add_new_card_hand($deck_opponent, \"CS2_boar\", holder)
"
}
}
@@ -0,0 +1,14 @@
# Misha
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
},
".section properties" : {
"all": [ "taunt" ]
}
}
@@ -0,0 +1,14 @@
# Huffer
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$enemy_minions"
},
".section properties" : {
"all": [ "charge" ]
}
}
@@ -0,0 +1,14 @@
# Hex
{
".section attack" : {
"code" : "
hsl_attack($attacker, $defenders);
",
"target" : "$minions"
},
".section properties" : {
"all": [ "taunt" ]
}
}
+45
View File
@@ -0,0 +1,45 @@
'''
hm_gameserver - hearthmod gameserver
Copyright (C) 2016 Filip Pancik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
RF_SECTION = 1
no_levelup = 0
file_entities = "../../src/proto/ent.c"
file_flags_sections = "../flags_sections"
file_ent_sections = "../../src/proto/ent_sections.c"
file_levelup_c = "../../src/levelup.c"
file_levelup_h = "../../src/include/levelup.h"
sections = {
"buff": ["./include/section_buff.h", "BUFF", []],
"battlecry": ["./include/section_battlecry.h", "BATTLECRY", []],
"defender": ["./include/section_defender.h", "DEFENDER", []],
"spell_aoe": ["./include/section_spell_aoe.h", "SPELL_AOE", []],
"spell": ["./include/section_spell.h", "SPELL", []],
"attack": ["./include/section_attack.h", "ATTACK", []],
"attack_effect": ["./include/section_attack_effect.h", "ATTACK_EFFECT", []],
"weapon": ["./include/section_weapon.h", "WEAPON", []],
"endturn": ["./include/section_endturn.h", "ENDTURN", []],
"onboard": ["./include/section_onboard.h", "ONBOARD", []],
"destroyed": ["./include/section_destroyed.h", "DESTROYED", []],
"weapon_destroyed": ["./include/section_weapon_destroyed.h", "WEAPON_DESTROYED", []],
"idle": ["./include/section_idle.h", "IDLE", []],
"weapon_attack": ["./include/section_weapon_attack.h", "WEAPON_ATTACK", []],
"attachment_attack": ["./include/section_attachment_attack.h", "ATTACHMENT_ATTACK", []],
"attack_effect_attachment": ["./include/section_attack_effect_attachment.h", "ATTACK_EFFECT_ATTACHMENT", []],
}
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
@globals
$player, $opponent
$player_deck, $opponent_deck
$none, $all, $minions, $enemy_minions, $enemy_hero, $enemies, $ally_minions, $ally_hero, $allies, $aoe
#.random: $r_all, $r_enemy_minions, $r_enemies, $r_ally_minions, $r_allies
$zone_play, $zone_deck, $zone_hand, $zone_graveyard, $zone_discard, $zone_setaside, $zone_secret
$attacker, $defenders, $turn
@functions
struct card_s *draw_card(dst, name, amount)
void buff_attack_expire(round, defender, attack)
void add_attachment(player)
+101
View File
@@ -0,0 +1,101 @@
'''
hm_gameserver - hearthmod gameserver
Copyright (C) 2016 Filip Pancik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import os
from couchbase.bucket import Bucket
import config, util, target, parser
def start_sections():
os.system("rm %s" % config.file_flags_sections)
util.write(config.file_ent_sections, "#include <ent_gen.h>\n#include <ent.h>\n\n", "w")
util.write(config.file_ent_sections, "void entities_init2() {\n", "a")
print 'Starting sections:'
for s in config.sections:
b = "#ifndef SECTION_%s_H_\n" % config.sections[s][1].upper()
b += "#define SECTION_%s_H_\n\n" % config.sections[s][1].upper()
util.write(config.sections[s][0], b, "w")
print '\t%s' % config.sections[s][0]
util.write(config.file_levelup_c, "#include <hsl_cardname.h>\n#include <levelup.h>\n\nstruct levelup_s levelup[MAX_LEVELUP] = {\n", "w")
def end_sections():
print 'Ending sections:'
for s in config.sections:
b = '#define __SECTION_%s\\\n' % s.upper()
for t in config.sections[s][2]:
b += '\t%s\\\n' % t
util.write(config.sections[s][0], b, "a")
b = "\n#endif"
util.write(config.sections[s][0], b, "a")
print '\t%s' % config.sections[s][0]
util.write(config.file_ent_sections, "}\n", "a")
util.write(config.file_levelup_c, "};", "a")
lh = "#ifndef LEVELUP_H_\n#define LEVELUP_H_\n\
#define MAX_LEVELUP %d\n\
struct levelup_s {\n\
const char *dst;\n\
const char *src;\n\
};\n\
extern struct levelup_s levelup[MAX_LEVELUP];\n\
#endif" % config.no_levelup
util.write(config.file_levelup_h, lh, "w")
if __name__ == "__main__":
start_sections()
rootDir = './cards/'
p = parser.parser()
cb = Bucket('couchbase://localhost/hbs', password='aci')
loaded = cb.get('u:mod_dota').value
for c in loaded['cards']:
name = ''
for k in c:
if k[0] == '__name':
name = k[1]
if k[0] == '__code': # code comes later than name
p.parse_card(k[1], name)
'''
for c in loaded:
for r in loaded[c]:
for i in loaded[c][r]:
print i
# files
for dir_, dirnames, files in os.walk(rootDir):
dirnames.sort()
files.sort()
for fileName in files:
if(fileName.endswith(".card")):
relDir = os.path.relpath(dir_, rootDir)
relFile = os.path.join(relDir, fileName)
p.parse_card(rootDir + relFile)
'''
end_sections()
+303
View File
@@ -0,0 +1,303 @@
'''
hm_gameserver - hearthmod gameserver
Copyright (C) 2016 Filip Pancik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import json, re
import util, target, config
class parser:
def __init__(self):
self.allowed = self.allowed_sections()
def allowed_sections(self):
loaded = util.read("allowed", 0)
read = 0
al = {}
for a in loaded:
if a.startswith('#'):
continue
elif a.startswith('@'):
if(a.find('section') > -1):
read |= config.RF_SECTION
continue
elif a.startswith('\n'):
read = 0
continue
else:
if((read & config.RF_SECTION) == config.RF_SECTION):
n = a.split(":")
al[n[0]] = n[1].replace("\n", "")
return al
def match_allowed_section(self, dst, src, parent):
for d in dst:
cx = src.split(" ")
if(len(cx) > 1):
if(cx[1] == d):
return [dst[d], src, d]
return []
def match_allowed_sub(self, dst, src):
sub = []
a = src.replace("\n", "").split(",")
for d in dst:
for e in a:
if(e == d):
sub.append([e, dst[d]])
return sub
def card_battlecry_target(self, obj, card):
type = obj[0]
target = obj[1]
print type
def parse_card(self, b, name):
'''
# files
f = util.read(c, 0)
b = ''
for l in f:
b += l.replace("\n","").replace("\t","")
'''
# ignore first line
b = b[b.find('\n') + 1:b.rfind('\n')]
b = b.replace("\n","").replace("\t","")
try:
j = json.loads(b)
except:
print 'parsing json failed %s [%s]' % (name, b)
exit(1)
p = []
for i in j:
f = self.match_allowed_section(self.allowed, i, j)
if(len(f) > 0):
s = self.match_allowed_sub(j[f[1]], f[0])
p.append([f[2], s])
#crd = re.findall("[\w]+.card", c)
#crd = name.split(".")
for i in p:
#print i
for s in i:
if s != 'battlecry' and i[0] == 'battlecry':
util.store_flag(config.file_ent_sections, 'CARD_BATTLECRY', name)
for ms in s:
if 'target' in ms:
for t in target.battlecry[ms[1]]:
util.store_flag(config.file_ent_sections, t, name)
elif 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'weapon' and i[0] == 'weapon':
util.store_flag(config.file_ent_sections, 'CARD_SPELL', name)
util.store_flag(config.file_ent_sections, 'CARD_AOE', name)
util.store_flag(config.file_ent_sections, 'CARD_WEAPON', name)
util.store_flag(config.file_ent_sections, 'CARD_NONTARGET', name)
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'endturn' and i[0] == 'endturn':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'spell_aoe' and i[0] == 'spell_aoe':
util.store_flag(config.file_ent_sections, 'CARD_SPELL', name)
util.store_flag(config.file_ent_sections, 'CARD_AOE', name)
for ms in s:
if 'target' in ms:
for t in target.regular[ms[1]]:
util.store_flag(config.file_ent_sections, t, name)
elif 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'spell' and i[0] == 'spell':
util.store_flag(config.file_ent_sections, 'CARD_SPELL', name)
for ms in s:
if 'target' in ms:
for t in target.regular[ms[1]]:
util.store_flag(config.file_ent_sections, t, name)
elif 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'attack' and i[0] == 'attack':
util.store_flag(config.file_ent_sections, 'CARD_MINION', name)
util.store_flag(config.file_ent_sections, 'CARD_TARGETING', name)
for ms in s:
if 'target' in ms:
for t in target.regular[ms[1]]:
util.store_flag(config.file_ent_sections, t, name)
elif 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'attack_effect' and i[0] == 'attack_effect':
util.store_flag(config.file_ent_sections, 'CARD_MINION', name)
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'onboard' and i[0] == 'onboard':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif s != 'destroyed' and i[0] == 'destroyed':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_defender")
elif s != 'defender' and i[0] == 'defender':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_defender")
elif s != 'weapon_destroyed' and i[0] == 'weapon_destroyed':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_weapon")
elif s != 'idle' and i[0] == 'idle':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_attacker")
elif s != 'weapon_attack' and i[0] == 'weapon_attack':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_weapon")
elif s != 'attachment_attack' and i[0] == 'attachment_attack':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_attacker")
elif s != 'attack_effect_attachment' and i[0] == 'attack_effect_attachment':
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "fake_attacker")
elif s != 'properties' and i[0] == 'properties':
for ms in s:
if 'all' in ms:
for mss in ms[1]:
util.store_flag(config.file_ent_sections, "CARD_%s" % mss.upper(), name)
if 'levelup' in ms:
self.levelup(config.file_levelup_c, name, ms[1])
#for mss in ms[1]:
# util.store_flag(config.file_ent_sections, "CARD_%s" % mss.upper(), name)
elif s != 'buff' and i[0] == 'buff':
util.store_flag(config.file_ent_sections, 'CARD_BUFF', name)
util.store_flag(config.file_ent_sections, 'CARD_SPELL', name)
for ms in s:
if 'code' in ms:
ms[1] = ms[1].replace("$", "HSL_")
self.store(name, i[0], ms[1], config.sections[i[0]][0], "attacker")
elif 'target' in ms:
for t in target.regular[ms[1]]:
util.store_flag(config.file_ent_sections, t, name)
def levelup(self, f, dst, src):
util.write(f, "\t{%s, \"%s\"},\n" % (src, dst), "a")
config.no_levelup = config.no_levelup + 1
def store(self, card, section, code, path, entity):
#c = re.findall("[\w]+.card", card)
#c = c[0].split(".")
if(section == 'endturn'):
buf = '#define %s_%s\\\n\
{\\\n\
%s\\\n\
}\n\n' % (section, card, code)
elif(section == 'idle'):
buf = '#define %s_%s\\\n\
{ %s }\\\n\
\n\n' % (section, card, code)
elif(section == 'attack_effect_attachment'):
buf = '#define %s_%s\\\n\
{\\\n\
%s\\\n\
}\n\n' % (section, card,code)
elif(section == 'attachment_attack'):
buf = '#define %s_%s\\\n\
{\\\n\
int count = hsl_count_attachments(HSL_fake_deck, NULL, HSL_fake_attacker, "%s");\\\n\
if(count == 1) {\\\n\
%s\\\n\
}}\n\n' % (section, card, card, code)
else:
buf = '#define %s_%s\\\n\
if(HSL_%s && flag(&(HSL_%s->state), %s_%s_FLAG, FLAG_ISSET)) {\\\n\
%s\\\n\
}\n\n' % (section, card, entity, entity, section, card, code)
util.write(path, buf, "a")
config.sections[section][2].append("%s_%s" % (section, card))
flag = "%s_%s_FLAG, 1000\n" % (section, card)
util.write(config.file_flags_sections, flag, "a")
flag1 = "%s_%s_FLAG" % (section, card)
util.store_flag(config.file_ent_sections, flag1, card)
+63
View File
@@ -0,0 +1,63 @@
'''
hm_gameserver - hearthmod gameserver
Copyright (C) 2016 Filip Pancik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
regular = {
"$all" : ["CARD_TARGET_ALL", "CARD_TARGETING"],
"$minions" : ["CARD_TARGET_MINIONS", "CARD_TARGETING"],
"$hero" : ["CARD_TARGET_HERO", "CARD_TARGETING"],
"$enemy_hero" : ["CARD_TARGET_ENEMY_HERO", "CARD_TARGETING"],
"$enemy_minions" : ["CARD_TARGET_ENEMY_MINIONS", "CARD_TARGETING"],
"$ally_hero" : ["CARD_TARGET_ALLY_HERO", "CARD_TARGETING"],
"$ally_minions" : ["CARD_TARGET_ALLY_MINIONS", "CARD_TARGETING"],
"$ally_bosses" : ["CARD_TARGET_ALLY_BOSSES", "CARD_TARGETING"],
"$enemy_bosses" : ["CARD_TARGET_ENEMY_BOSSES", "CARD_TARGETING"],
"$bosses" : ["CARD_TARGET_BOSSES", "CARD_TARGETING"],
"$ally_board" : ["CARD_TARGET_ALLY_BOARD", "CARD_TARGETING"],
"$enemy_board" : ["CARD_TARGET_ENEMY_BOARD", "CARD_TARGETING"],
"$board" : ["CARD_TARGET_BOARD", "CARD_TARGETING"],
"$ally" : ["CARD_TARGET_ALLY", "CARD_TARGETING"],
"$enemy" : ["CARD_TARGET_ENEMY", "CARD_TARGETING"],
"$auto" : ["CARD_NONTARGET"],
"$undamaged_minions":["CARD_TARGET_UNDAMAGED_MINION", "CARD_TARGETING"],
"$damaged_minions":["CARD_TARGET_DAMAGED_MINION", "CARD_TARGETING"],
"$attack5more_minions":["CARD_TARGET_5ATTACK_MORE", "CARD_TARGETING"],
"$attack3less_minions":["CARD_TARGET_3ATTACK_LESS", "CARD_TARGETING"],
"$health_below_30p_minions":["CARD_TARGET_30PERCENT_LESS", "CARD_TARGETING"],
"$URSA":["CARD_TARGET_URSA", "CARD_TARGETING"],
"$SVEN":["CARD_TARGET_SVEN", "CARD_TARGETING"],
}
battlecry = {
"$all" : ["CARD_TARGET_ALL", "CARD_TARGETING_BC"],
"$minions" : ["CARD_TARGET_MINIONS", "CARD_TARGETING_BC"],
"$hero" : ["CARD_TARGET_HERO", "CARD_TARGETING_BC"],
"$enemy_hero" : ["CARD_TARGET_ENEMY_HERO", "CARD_TARGETING_BC"],
"$enemy_minions" : ["CARD_TARGET_ENEMY_MINIONS", "CARD_TARGETING_BC"],
"$ally_hero" : ["CARD_TARGET_ALLY_HERO", "CARD_TARGETING_BC"],
"$ally_minions" : ["CARD_TARGET_ALLY_MINIONS", "CARD_TARGETING_BC"],
"$ally" : ["CARD_TARGET_ALLY", "CARD_TARGETING_BC"],
"$enemy" : ["CARD_TARGET_ENEMY", "CARD_TARGETING_BC"],
"$ally_bosses" : ["CARD_TARGET_ALLY_BOSSES", "CARD_TARGETING_BC"],
"$enemy_bosses" : ["CARD_TARGET_ENEMY_BOSSES", "CARD_TARGETING_BC"],
"$bosses" : ["CARD_TARGET_BOSSES", "CARD_TARGETING_BC"],
"$ally_board" : ["CARD_TARGET_ALLY_BOARD", "CARD_TARGETING_BC"],
"$enemy_board" : ["CARD_TARGET_ENEMY_BOARD", "CARD_TARGETING_BC"],
"$board" : ["CARD_TARGET_BOARD", "CARD_TARGETING_BC"],
"$auto" : ["CARD_NONTARGET_BC"],
"$undamaged_minions":["CARD_TARGET_UNDAMAGED_MINION", "CARD_TARGETING_BC"],
"$damaged_minions":["CARD_TARGET_DAMAGED_MINION", "CARD_TARGETING_BC"],
}
+52
View File
@@ -0,0 +1,52 @@
'''
hm_gameserver - hearthmod gameserver
Copyright (C) 2016 Filip Pancik
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import re
import config
def write(f, buf, m):
l = open(f, m)
l.write(buf)
l.close()
def read(f, t):
f = open(f, "r")
if(t == 0):
b = []
c = f.readlines()
for l in c:
if l.startswith('#'):
continue
b.append(l)
return b
else:
b = f.read()
f.close()
return b
def store_flag(dst, f, i):
if(f.find("ENABLED") > -1):
return
lines = read(config.file_entities, 0)
for l in lines:
if(l.find("{ \"%s\"" % i) > -1):
index = re.findall("// [\w]+", l)[0].split(" ")[1]
write(dst, "\tflag(&entities[%s].flags, %s, FLAG_SET);\n" % (index, f), "a")
break