Documentation ¶
Index ¶
- Constants
- Variables
- func AICalAllDist()
- func AICalTechObjs(ip int, move_loc []int)
- func AIMakeDecision(ip int, move_loc []int)
- func AISetArg(ip int, goal int, fact_att, fact_def, fact_move int)
- func CalDist(center int, weight []int, dist []int)
- func Do() (st int)
- func DoOneTurn() (status int)
- func DoPeople(ip int, ui UI) bool
- func DoTech(ip int, itech int, obj_loc int, ui UINote) (is_err bool)
- func GetAoeRange(cloc int, d int) (aloc []int)
- func IAbs(a int) int
- func Init(ui_note UINote, ui_select [2]UISelect, ftech, fmap io.Reader, ...) bool
- func InitAI()
- func InitMiniPath()
- func LoadAI(ftech, fmap io.Reader) bool
- func LoadAIBase(fin io.Reader) bool
- func LoadAIPeople(fin io.Reader) bool
- func LoadDX(fin io.Reader) bool
- func LoadIntro(fin_name string)
- func LoadMap(fin io.Reader, ui UINote) bool
- func LoadPeople(fin io.Reader, ui UINote) bool
- func LoadTech(fin io.Reader) bool
- func Loc2XY(loc int) (x, y int)
- func LocDist(l1, l2 int) int
- func MapClearPath(is_valid bool)
- func MapUpdataAux()
- func MapUpdateWeight(opt int)
- func MovePeople(ip int, iloc int, ui UINote)
- func RemovePeople(ip int, ui UINote)
- func SetMovingRange(ip int) (valid_loc []int)
- func SetPeople(ip int, iloc int, ui UINote)
- func SetTechRange(ip int, itech int)
- func StartTurnPeople()
- func XY2Loc(x, y int) (loc int)
- type AIPeople
- type Location
- type MPEdge
- type NCursesUI
- func (nui *NCursesUI) CenterCursor()
- func (nui *NCursesUI) DoTech(itech, p_src, p_obj, l_obj int)
- func (nui *NCursesUI) DrawGrid(x, y int, hp_down int)
- func (nui *NCursesUI) DrawInfo()
- func (nui *NCursesUI) DrawMapStatic()
- func (nui *NCursesUI) End()
- func (nui *NCursesUI) GameOver(win_opt int)
- func (nui *NCursesUI) GameStart()
- func (nui *NCursesUI) HPDown(ip, loc, hp, dhp int)
- func (nui *NCursesUI) LoadMapDone()
- func (nui *NCursesUI) LocBuf(loc, att_def, val, dur int)
- func (nui *NCursesUI) LocDisableLong(loc, dur int)
- func (nui *NCursesUI) LocFly(loc, weight, dur int)
- func (nui *NCursesUI) PeopleIn(ip, loc int)
- func (nui *NCursesUI) PeopleMove(ip, loc_start, loc_end int)
- func (nui *NCursesUI) PeopleOut(ip, loc int)
- func (nui *NCursesUI) PeopleStep(ip, loc, dir int)
- func (nui *NCursesUI) ShowGrid(x, y int)
- func (nui *NCursesUI) ShowMsg(msg string)
- func (nui *NCursesUI) TurnStart(opt int)
- func (nui *NCursesUI) Update()
- func (nui *NCursesUI) UpdateCursor(cx, cy int, hp_down int)
- func (nui *NCursesUI) UpdateScroll()
- type NCursesUIAISelect
- type NCursesUISelect
- func (nuis *NCursesUISelect) BrowseOperation(c goncurses.Key, cur_p *int)
- func (nuis *NCursesUISelect) Confirm(msg string) bool
- func (nuis *NCursesUISelect) SelObj(status SelObjStatus, itech int, valid_loc []int) int
- func (nuis *NCursesUISelect) SelTech(ip int) int
- func (nuis *NCursesUISelect) TurnStart(opt int)
- type People
- type SelObjStatus
- type Tech
- type UI
- type UINote
- type UISelect
Constants ¶
View Source
const ( TST_NORMAL = -1 TST_WIN = 0 TST_LOSS = 1 TST_QUIT = 2 )
View Source
const ( TC_PEOPLE = 0 /* 时间, 范围均不可变 */ TC_ABI_BUF = 1 TC_DEF_BUF = 2 /* 时间固定, 范围可变 */ TC_FLY = 3 /* 时间, 范围均可变 */ TC_DISABLE_LONG = 4 )
View Source
const (
NEIGHBOUR_WEIGHT_SCALE = 2
)
View Source
const (
NUM_WTECH int = 10
)
Variables ¶
View Source
var ( AI_MAX_MOVE_DIST int AI_MAX_MOVE_SCORE int AI_MAX_BUF_VALUE int AI_MAX_BUF_SCORE int AI_MAX_DEF_DIST int AI_MAX_DEF_SCORE int AI_MAX_TECH_DIST int AI_MAX_TECH_SCORE int AI_MAX_TECH_BUF_VMD int AI_MAX_TECH_FLY_VMD int AI_MAX_TECH_DL_VMD int )
View Source
var ( MAX_FLY_WEIGHT int MAX_ABI int )
View Source
var (
MAP_SIZE [2]int
)
Functions ¶
func AICalTechObjs ¶
func GetAoeRange ¶
func InitMiniPath ¶
func InitMiniPath()
func LoadAIBase ¶
func LoadAIPeople ¶
func MapClearPath ¶
func MapClearPath(is_valid bool)
func MapUpdataAux ¶
func MapUpdataAux()
func MapUpdateWeight ¶
func MapUpdateWeight(opt int)
func MovePeople ¶
func RemovePeople ¶
func SetMovingRange ¶
func SetTechRange ¶
func StartTurnPeople ¶
func StartTurnPeople()
Types ¶
type NCursesUI ¶
type NCursesUI struct {
// contains filtered or unexported fields
}
func InitNCursesUI ¶
func InitNCursesUI() *NCursesUI
func (*NCursesUI) CenterCursor ¶
func (nui *NCursesUI) CenterCursor()
func (*NCursesUI) DrawMapStatic ¶
func (nui *NCursesUI) DrawMapStatic()
func (*NCursesUI) LoadMapDone ¶
func (nui *NCursesUI) LoadMapDone()
func (*NCursesUI) LocDisableLong ¶
func (*NCursesUI) PeopleMove ¶
func (*NCursesUI) PeopleStep ¶
func (*NCursesUI) UpdateCursor ¶
func (*NCursesUI) UpdateScroll ¶
func (nui *NCursesUI) UpdateScroll()
type NCursesUIAISelect ¶
type NCursesUIAISelect struct { *NCursesUISelect // contains filtered or unexported fields }
func InitNCursesUIAISelect ¶
func InitNCursesUIAISelect(opt int, nui *NCursesUI) *NCursesUIAISelect
func (*NCursesUIAISelect) Confirm ¶
func (nuis *NCursesUIAISelect) Confirm(msg string) bool
return true to confirm quit
func (*NCursesUIAISelect) SelObj ¶
func (nuis *NCursesUIAISelect) SelObj(status SelObjStatus, itech int, valid_loc []int) int
return -1 to quit, -2 to end turn (only for SOS_PEOPLE)
func (*NCursesUIAISelect) SelTech ¶
func (nuis *NCursesUIAISelect) SelTech(ip int) int
return -1 to give up tech use
func (*NCursesUIAISelect) TurnStart ¶
func (nuis *NCursesUIAISelect) TurnStart(opt int)
type NCursesUISelect ¶
type NCursesUISelect struct { *NCursesUI // contains filtered or unexported fields }
func InitNCursesUISelect ¶
func InitNCursesUISelect(opt int, nui *NCursesUI) *NCursesUISelect
func (*NCursesUISelect) BrowseOperation ¶
func (nuis *NCursesUISelect) BrowseOperation(c goncurses.Key, cur_p *int)
func (*NCursesUISelect) Confirm ¶
func (nuis *NCursesUISelect) Confirm(msg string) bool
func (*NCursesUISelect) SelObj ¶
func (nuis *NCursesUISelect) SelObj(status SelObjStatus, itech int, valid_loc []int) int
func (*NCursesUISelect) SelTech ¶
func (nuis *NCursesUISelect) SelTech(ip int) int
func (*NCursesUISelect) TurnStart ¶
func (nuis *NCursesUISelect) TurnStart(opt int)
type SelObjStatus ¶
type SelObjStatus int
const ( SOS_PEOPLE SelObjStatus = 0 SOS_MOVE_OBJ SelObjStatus = 1 SOS_TECH_OBJ SelObjStatus = 2 )
type UINote ¶
type UINote interface { /* DoTech triger before HPDown, Loc.. */ DoTech(itech, p_src, p_obj, l_obj int) HPDown(ip, loc, hp, dhp int) PeopleIn(ip, loc int) PeopleOut(ip, loc int) /* PeopleMove trigger after PeopleStep */ PeopleMove(ip, loc_start, loc_end int) PeopleStep(ip, loc, dir int) /* att_def: 0: att; 1: def */ LocBuf(loc, att_def, val, dur int) LocFly(loc, weight, dur int) LocDisableLong(loc, dur int) LoadMapDone() GameStart() /* win_opt == -1: 退出*/ GameOver(win_opt int) }
all UI event is driven before data update
type UISelect ¶
type UISelect interface { TurnStart(opt int) /* return -1 to quit, -2 to end turn (only for SOS_PEOPLE) * valid_loc is only valid in SOS_MOVE_OBJ status * */ SelObj(status SelObjStatus, itech int, valid_loc []int) int /* return -1 to give up tech use */ SelTech(ip int) int /* return true to confirm */ Confirm(msg string) bool }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.