func NewGroup(pl *Player, name ll_type) *Group { return &Group{ Events: dispatcher.NewForkEvent(pl.GetFork()), owner: pl, name: name, Cards: *NewCards(), } }
func newPlayer(yg *YGO) *Player { pl := &Player{ Events: dispatcher.NewForkEvent(yg.GetFork()), camp: 1, lp: 0, drawSize: 1, maxHp: ^uint(0), maxSdi: 6, overTime: time.Second * 120, waitTime: time.Second * 60, replyTime: time.Second * 20, } var pr uint pl.MsgChan = NewMsgChan(func(m AskCode) bool { if m.Uniq != 0 { if ca := pl.Game().getCard(m.Uniq); ca != nil { //fmt.Println(ca) if m.Method == uint(LI_Over) { if pr != 0 { pl.Game().callAll(offTouch(pr)) pr = 0 } pl.GetTarget().call(onTouch(m.Uniq)) } else if m.Method == uint(LI_Out) { if pr == m.Uniq { pr = 0 } pl.Game().callAll(offTouch(m.Uniq)) } else { return true } } } else if m.Method == LI_Defeat { pl.Fail() } else { return true } return false }) pl.area = map[ll_type]*Group{} pl.AddEvent(RoundBegin, func() { pl.MsgPub("msg.002", Arg{"round": fmt.Sprint(pl.GetRound())}) pl.SetCanSummon() pl.rounding = true }) pl.AddEvent(RoundEnd, func() { pl.MsgPub("msg.003", Arg{"round": fmt.Sprint(pl.GetRound())}) pl.SetCanSummon() pl.rounding = false }) pl.AddEvent(ChangeLp, pl.changeLp) return pl }
func (co *CardOriginal) Make(pl *Player) *Card { c := &Card{ Events: dispatcher.NewForkEvent(pl.GetFork()), baseOriginal: co, owner: pl, summoner: pl, le: LE_FaceDownAttack, } c.InitUint() c.Init() pl.Game().registerCards(c) return c }