Territory War

How to use it

use pip3 to install django and channels:

pip3 install Django

pip3 install channels

go to CardGame/first/consumers.py and go to Line 36

change the path which contain “first” folder

To create database , first , install mysql.connector

pip3 install mysql-connector-python

go to CardGame/first/Database.py use function




change the path which contain manage.py file

python3.9 manage.py runserver

Game’s content


When you in this game , you must register a account number , click ‘注册’.


And then you can access this game.


In this game you can click ‘新建套牌’ to create a deck.


After creating a deck, you can click ‘匹配’ to match a opponent, waiting for the opponent.


How to diy a card

go to /CardGame/first/father.py

you will see the superclass of the card called card

It have and function, Rcost() is to output the the final cost

such as [‘g’,’g’,’g’,’g’,’g’]

It means this card have 5 green


This is the cost bar 5 green means your cost bar must have a number greater than 5 in the last row

There are three subclass servent magic ground , ignore the shelter

you can see there are lots of function in servent


you can over override:

ZhanHong(self,MyMaster,Master,selectIndex=None):# when use servent the function is used

WangYu(self,MyMaster,Master): # when servent is die function is uesd

WhenBeAttack(self,MyMaster,Master,otherServent):# when serveny be attack use this function

whenSendData(self,MyMaster,Master):#used to make Aura

whenTermFinish(self,MyMaster,Master):# when round finish use this function

The class called Master is protagonist

The live is your live

groundList is your cost bar

cardHand cardGround cardStorage tomb all store card object

cardHand store the cards in your hand

cardGround store the cards in your Battle field

cardStorage store the cards in your cards library

tomb store the servant who have been died

getCard(self,num): is to draw a card , it will return the array which contain the objects you get

Now start to make a card, go to /CardGame/first/cardServent.py

This is the example


you must override the founction to create the skill

warning: your subclass name must the same as your cards name


View Github