Example #1
0
        private void PerformAction(ActionHolders holder, ActionHolder action, MapElementInfo info)
        {
            FDataAction da = action.DataAction();

            //can use?
            if (!action.req.Check(info.Player(), info, info.Pos()))
            {
                //TODO not hardcoded
                //start interact action?
                if (da.mapElement && holder.Contains("interact") && da.field == "near")
                {
                    PerformAction(holder, holder.Get("interact"), info);
                    return;
                }

                ShowPanelMessageError(action.req.Desc(info.Player(), info, info.Pos()));
                return;
            }

            //check ap
            if (action.cost > info.data.ap)
            {
                ActionHelper.WaitRound(holder, action, info, info.Pos());
                return;
            }

            string mess = holder.Perform(action, ActionEvent.Direct, S.ActPlayer(), info, info.Pos());

            if (mess != null)
            {
                ShowPanelMessageError(mess);
            }
        }
        public override void Perform()
        {
            //check ap
            if (action.DataAction().cost > self.data.ap)
            {
                ActionHelper.WaitRound(holders, action, self, pos);
                return;
            }

            string erg = holders.Perform(action, ActionEvent.Direct, S.ActPlayer(), self, pos);

            if (erg != null)
            {
                UIHelper.ShowOk(action.DataAction().Name(), erg);
            }
        }