?? cbeyes.h
字號:
/////////////
// CBEyes.h : v0020
// Written by : Liu Gang
// Compiler : Microsoft Visual C++ 4.2
// Copyright (C) : 1996 WayAhead Corporation
// v0010 : Feb.26.1997
// v0020 : Apr.29.1997, add so many functions
/////////////
// header file
// This file is to give thinking methods information they need.
// so call them Eyes.
#ifndef __CBEYES_H__
#define __CBEYES_H__
#include "cbgame.h"
#define MAINBATTALION 0 //帥帳
#define DOGFACE 1 //步兵所
#define BOW 2 //弓兵所
#define QIANZHUANG 3 //錢莊
#define LIANGCANG 4 //糧倉
#define QIBINGSUO 5 //騎兵所
#define CHEBINGSUO 6 //車兵所
#define JIANLOU 7 //箭樓
#define MUCAICHANG 8 //木材廠
#define WUQICHANG 9 //武器廠
#define CHUANWU 10 //船塢
struct BUILDP{
UNIT_STRUCT * BPoint;
WORD hPos;
};
extern struct BUILDP BuildPoint[5][15];
//掃描游戲者擁有的建筑
extern void EYE_ScanBuildAlife(WORD Player);
// 本能策略
/////////////
// 取得本單元附近的(視野內)其它單元的ID
// bFriend : 輸入,0——取得所有單元,1——取得我方單元,2——取得敵方單元
// wThis : 輸入,本單元ID
// pwArray : 輸出,其它單元的ID數組
// nNum : 輸入,需要的其它單元的數量;輸出,實際返回的單元數量
void EYE_GetUnitInSight( int bFriend, WORD wThis, WORD *pwArray, int *pnNum );
// 取得本部隊的其它單元的ID
// bFriend : 輸入,0——取得所有單元,1——取得我方單元,2——取得敵方單元
// wThis : 輸入,本單元ID
// pwArray : 輸出,其它單元的ID數組
// nNum : 輸入,需要的其它單元的數量;輸出,實際返回的單元數量
void EYE_GetUnitInGroup( int bFriend, WORD wThis, WORD *pwArray, int *pnNum );
//-----------------------------------
#ifndef TNDEBUG
/////////////
// 檢測目的單元是否在視野內
// wThis : 本單元ID
// wThat : 目的單元ID
// nRange : 視野范圍,缺?。?1)時為第一個單元的視野
// return : -1,不在視野以內,0-7是方向
BOOL EYE_IfUnitIsInSight( WORD wThis, WORD wThat, int nRange = -1 );
// 檢測目的單元是否在攻擊范圍內
// wThis : 本單元ID
// wThat : 目的單元ID
// nRange : 硬性規定的判定范圍,缺省時為部隊的攻擊范圍
// return : -1,不在射程以內,0-7是方向
BOOL EYE_IfUnitIsInRange( WORD wThis, WORD wThat, int nRange = -1 );
// 檢測目的位置是否在某單元位置一格范圍內
// pUnit : 被檢測的單元
// nEndX, nEndY : 被檢測的目的地形位置
// return : -1,不在射程以內,0-7是方向
int EYE_IfShipYardIsInRange( struct UNIT_STRUCT *pUnit, int nEndX, int nEndY );
/////////////
/////////////
// 檢測該單元是否是有效
extern BOOL EYE_IfUnitIsUnit( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是建筑
extern BOOL EYE_IfUnitIsBuild( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是將領
extern BOOL EYE_IfUnitIsGen( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是文將
extern BOOL EYE_IfUnitIsWorkerGen( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是工人
extern BOOL EYE_IfUnitIsWorker( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是平民
extern BOOL EYE_IfUnitIsMan( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是資源
extern BOOL EYE_IfUnitIsRes( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否是特殊圖素
extern BOOL EYE_IfUnitIsSpec( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否有Soldier域,可以組建成部隊
extern BOOL EYE_IfUnitIsSoldier( struct UNIT_STRUCT *pUnit );
// 檢測該單元是否可以移動
extern BOOL EYE_IfUnitIsMovable( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是弓箭手
extern BOOL EYE_IfUnitIsArcher( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是箭樓
extern BOOL EYE_IfUnitIsTower( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是船
extern BOOL EYE_IfUnitIsShip( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是戰船
extern BOOL EYE_IfUnitIsBattleShip( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是運輸船
extern BOOL EYE_IfUnitIsTransport( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是投石車
extern BOOL EYE_IfUnitIsCatapult( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是騎兵
extern BOOL EYE_IfUnitIsCavalry( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是城門
extern BOOL EYE_IfUnitIsDoor( struct UNIT_STRUCT *pUnit );
/////////////
/////////////
// 查看兩個君主是否同盟
extern BOOL EYE_PlayerIsAllied( int nPlayer1, int nPlayer2 );
// 查看該坐標是否超過的地圖的界限
extern BOOL EYE_IfOutOfRange( int nX, int nY );
// 查看該單元是否已經死了
extern BOOL EYE_IfUnitIsDead( struct UNIT_STRUCT *pUnit );
// 查看該單元是否是自己的
extern BOOL EYE_IfSheIsMine( struct UNIT_STRUCT *pUnit );
// 查看是否該單元處于焦點狀態
extern BOOL EYE_IfFocusOnUnit( struct UNIT_STRUCT *pUnit );
// 查看該單元是否到達目的地了
extern int EYE_IfArrived( struct UNIT_STRUCT *pUnit );
// 查看該地形點是否有地形型資源
// 麥田或樹林
// nZ, nX, nY : position on ground map
// return : resource type,QXZIYUAN時無效
extern int EYE_GetGResType( int nZ, int nX, int nY );
// 檢測該單元是否是資源
// 對于建筑“糧倉”也被認為是資源
// return : 返回該資源的類型,一定是建筑型類型,為QXZIYUAN時無效
extern int EYE_GetUResType( struct UNIT_STRUCT *pUnit, int nPlayer =-1 );
// 查看一個格子周圍是否有資源,只尋找地形型資源
// nFind : 要找的資源
// return : 找到資源的方向,0-7,為-1時無效
extern int EYE_IfResIsInRange( struct UNIT_STRUCT *pUnit, int nFind );
// 查看視野范圍內是否有資源,只尋找地形型資源
// nZ,nX, nY : 啟始位置
// nSight : 視野
// nFind : 要找的資源
// return : 找到資源的坐標位置,等于nX和nY時為未找到
extern POINT EYE_IfResIsInSight( int nZ, int nX, int nY, int nSight, int nFind );
// 尋找最近的家
// nPlayer : 君主
// nType : 0, 對于帶有糧食的工人,是主帥帳,糧倉
// 1, 對于帶有木材的工人,是主帥帳,木工房
// return : building ID, MAP_DATA_NONE為沒有
extern WORD EYE_FindNearestHome( int nPlayer, int nType );
// 得到該建筑是否可以接受資源
// pU : 被檢測的建筑
// return : 可以接受的資源的類型,QXZIYUAN為無效
extern int EYE_GetUResHome( struct UNIT_STRUCT *pU );
// 得到單元的士兵數量級別,官、曲、部、校
extern int EYE_GetUnitPerson( struct UNIT_STRUCT *pU );
/////////////
/////////////
// 得到某個單元的全滿生命值
// nPlayer : 游戲君主,為-1時不加附加值
// nFile : 文件號
extern int EYE_GetFullLife( int nPlayer, int nFile );
// 得到水的地形,TRUE為找到水邊,FALSE是沒找到
extern int EYE_GetWater(int nZ,int nX,int nY);
// 得到某個單元的將領,無或非法時為空
extern struct UNIT_STRUCT *EYE_GetGeneral( struct UNIT_STRUCT * pU );
// 得到近程攻擊力
extern int EYE_GetNearAttack( struct UNIT_STRUCT *pU );
// 得到遠程攻擊力
extern int EYE_GetFarAttack( struct UNIT_STRUCT *pU );
// 得到近程防御力
extern int EYE_GetNearDefend( struct UNIT_STRUCT *pU );
// 得到遠程防御力
extern int EYE_GetFarDefend( struct UNIT_STRUCT *pU );
// test if there is the bank of the water around the unit
// nLayer : layer of the unit
// nStartX, nStartY : position of the unit
// nLocationSize : location size of the unit
// return : TRUE if there is bank
BOOL EYE_IfNearBank( int nLayer, int nStartX, int nStartY, int nLocationSize );
// 檢測該部隊是否中計
// pU : 被檢測的單元
// nJiMou : 被檢測的計謀
extern BOOL EYE_IfInSTG( struct UNIT_STRUCT *pU, CTRL_JIMOU nJiMou );
extern BYTE EYE_GetMorale( struct UNIT_STRUCT *pU );
extern int EYE_GetViewRange( struct CTRL_FRAME_STRUCT *pDraw );
// 判斷此地是否被火燒
// nX, nY : 坐標
extern BOOL EYE_IfBurned( int nX, int nY );
// 判斷糧食是否不能存儲了——糧倉不夠
// 游戲君主ID
extern BOOL EYE_IfFoodExceeded( int nPlayer );
// 得到將領的15級級別
// nGenID : 被確定的將領單元的將領ID
extern int EYE_GetNewLevel( int nGenID );
// 得到將領的級別名稱
// nGenID : 被確定的將領單元的將領ID
// strLvlName : 級別名稱
// return : 名稱的ID號
extern int EYE_GetLevelName( int nGenID, LPSTR strLvlName );
// 得到武力
// nGenID : 將領ID
// return : 武力值
extern int EYE_GetWuLi( int nGenID );
// 得到智力
// nGenID : 將領ID
// return : 武力值
extern int EYE_GetZhiLi( int nGenID );
// 判斷該將領是否可以使用某個計謀
extern BOOL EYE_IfJiMou( int nGenID, CTRL_JIMOU JiMou );
// 判斷該將領是否可以單挑
extern BOOL EYE_IfFight( int nBlood1, int nPower1, int nBlood2, int nPower2 );
// 判斷某游戲者是否已經完蛋
// nPlayer : 被判定的游戲者
// nRun : 能移動的人數
// return : 為真時表示已經完蛋
extern BOOL EYE_IfPlayerIsOver( int nPlayer, int nRun );
/////////////
/////////////
//- Tian Yue
//尋找最近的特定物體
//傳入參數:
//nPlayer :游戲者的ID號
//nFile :要查尋物體的文件名
//X :本物體的X
//Y :本物體的Y
//傳出參數:
//失?。篗AP_DATA_NONE
//成功:要查尋物體的ID號
extern WORD TY_FindNearObject(WORD nPlayer,WORD nFile,WORD X,WORD Y);
extern WORD TY_FindNearHome(WORD player,WORD X,WORD Y,WORD TYPE);
/////////////
#endif // TNDEBUG
// 隨機數的產生
// min : 最小值
// max : 最大值
extern int getrandom( int min, int max );
#endif //__CBEYES_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -