Skip to content

Commit

Permalink
Submit codes of programming course final project which created in 201…
Browse files Browse the repository at this point in the history
…6/06.
  • Loading branch information
grassking100 committed Oct 26, 2021
0 parents commit 22866dc
Show file tree
Hide file tree
Showing 55 changed files with 12,458 additions and 0 deletions.
80 changes: 80 additions & 0 deletions index.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Messenger - 40243118S - 王擎天</title>
<style type="text/css">
</style></head>

<body>



<div align="left">
<table id="table1" border="0" width="100%">

<tbody>

<tr>

<td align="middle" valign="top" width="294"><img src="pic.jpg" align="top" border="0" height="200" width="200">
</td>

<td><strong>Messenger</strong> (作者:王擎天)
<p><strong>遊戲介紹</strong></p>

<pre>
***********************Welcome to the messenger******************************************
1.這是一款簡單的小遊戲,玩家是上天選擇的使者,要讓自己的陣營存活到最後並滅掉其他敵人
2.遊戲中玩家可以改變地型天氣來幫助玩家達到目的
3.遊戲中的氣候和地形會引響居民的健康.雪地會加速能量的流失,海洋會減少壽命,岩漿則大量減少壽命
5.遊戲中的生物可經無性生殖繁衍,並有一定的機率突變,這些生物將依照自己遺傳到的特徵來做出反應
7.每一種陣營都有它們適應的條件
8.每一陣營可建造寺廟來儲存食物
9.寺廟可以製造特殊效果
遊戲中玩家有袋子來裝土,裝滿就不能裝了,魔法值來施魔法,魔法值會隨時間補充
</pre>

</font></p>
<p><strong>操作說明</strong></p>

<pre>遊戲中玩家可以透過
w(W) 向上走
a(A) 向左走
s(S) 向下走
d(D) 向右走
p(P) 來暫停
********************************************************************************
對周圍的地型造成以下影響
o(O) 降低周圍地型的高度 (將背包中的土倒出來)
i(I) 提升周圍地型的高度 (將土裝進背包中)
********************************************************************************
對全球氣候造成以下影響(需魔法值)
k(K) 降低濕度
j(J) 提升濕度
n(N) 降低溫度
m(M) 提升溫度
對海平面造成影響(需魔法值)
2 降低海平面
8 提升海平面

</pre>
<p><br>
<b><a href="messenger.exe">立刻試用</a></b></p>

<p><b><a href="messenger.rar">原始碼</a></b></p>

<p>&nbsp;</p>



</td>
</tr>
</tbody>
</table>
</div>



</body>
</html>
Binary file added messenger.exe
Binary file not shown.
Binary file added pic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions source/Block.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include "Block.h"

void Block::setBackGround(Climate cl)
{

int wet=0;
int cold=1;
if(cl.temperature-(height*1.5)>0)
{
cold=0;
}

if(cl.humidity-height>0)
{
wet=1;
}
if(cl.seaLevel<height)
{
if(wet==1 && cold==0)
{
type=GRASS;
}
if(wet==0 && cold==0)
{
type=LAVA;
}
if(wet==0 && cold==1)
{
type=ROCK;
}
if(wet==1 && cold==1)
{
type=SNOW;
}
}
else
{
type=WATER;
}

}

char Block::setLegend(int* text,int* backG)
{
char icon;
if(type==WATER)
{
*text=LIGHT_BLUE;
*backG=BLUE;
icon='~';
}
else if(type==GRASS)
{
*text=YELLOW;
*backG=GREEN;
icon= 'v';
}
else if(type==LAVA)
{
*text=YELLOW;
*backG=RED;
icon= '~';
}
else if(type==ROCK)
{
*text=DARK_GREY;
*backG=LIGHT_GREY;
icon='O';
}
else
{
*text=BLACK;
*backG=WHITE;
icon= 'x';
}
return icon;
}

20 changes: 20 additions & 0 deletions source/Block.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef BLOCK_H_INCLUDED
#define BLOCK_H_INCLUDED
#include "Tool.h"
#include "Climate.h"
enum BlockType {GRASS,LAVA,SNOW,ROCK,WATER,E_RIVER,E_HARMONY,E_CATS,H_RIVER,H_HARMONY,H_CATS,BlockNumber};
class Block
{
public:
int height=0;
BlockType type=WATER;
char setLegend(int* text,int* backG);
Block(int _height,BlockType _type)
{
height=_height;
type=_type;
};
// void setBackGround();
void setBackGround(Climate cl);
};
#endif // BLOCK_H_INCLUDED
36 changes: 36 additions & 0 deletions source/Building.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef BUILDING_CPP_INCLUDED
#define BUILDING_CPP_INCLUDED
#include "Building.h"
bool hasNoFood(const Building &b)
{
return !b.hasFood();
};
char Building::setLegend(int* text,int* backG) const
{
if(type==Catastrophe)
{
*text=YELLOW;
*backG=RED;
}
else if(type==Harmony)
{
*text=RED;
*backG=PINK;
}
else if(type==River)
{
*text=BLACK;
*backG=LIGHT_BLUE;
}
else
{
*text=BLACK;
*backG=YELLOW;
}
return '@';
}
CountryType Building::getType()const
{
return type;
}
#endif // BUILDING_CPP_INCLUDED
63 changes: 63 additions & 0 deletions source/Building.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef BUILDING_H_INCLUDED
#define BUILDING_H_INCLUDED
#include "Country.h"
#include "Tool.h"
#include "Position.h"
const int FoodMax=1000;
class Building
{
private:

Position pos;
int food=0;
int foodCapacity=1000;
CountryType type=Atheism;
public:
int residue()const
{
return foodCapacity-food;
};
int foodNumber()const
{
return food;
};
void giveFood(int _food)
{
setValue(&food,_food,0,foodCapacity,Force);
};
int takeFood(int take)
{
if(take>=food)
{
int temp=food;
food=0;
return temp;
}
else
{
food-=take;
return take;
}
};

bool hasFood()const
{
return food>0;
};
void setType(CountryType _type)
{
type=_type;
};
Position getPosition()const
{
return pos;
}
void setPosition(Position _pos)
{
pos=_pos;
}
char setLegend(int* text,int* backG)const;
CountryType getType()const ;
};
bool hasNoFood(const Building &b);
#endif // BUILDING_H_INCLUDED
Loading

0 comments on commit 22866dc

Please sign in to comment.