注册 登录
编程论坛 Lua论坛

有道题想不通,

Pak00 发布于 2021-03-06 01:52, 1683 次点击

1、 写一个全局函数,返回带有以下属性和方法的玩家table
属性:玩家唯一Id,名字,等级,生命,拥有的技能id列表
基础法:每个属性的Get/Set方法
2、 居于第一题构造的玩家(player)实现技能的释放函数(释放逻辑随意发挥,可以根据你们对技能释放的流程理解来思考)
function SkillCast(casterPlayer, targetPlayer)
end



目前写到如下:
    local stand =
{
    id = 1,
    name = "888",
    level = 1,
    Hp = 10000,
    magic = 1000, --魔力
    skill = {
                a = {skill_name = "普攻" , magic = 0, damage = 20},
                One_Skill = { skill_name = "降龙十八掌" , magic = 400 , damage = 999 },
                trick_Skill = {skill_name = "四档" , magic = 1000 , damage = 1000 },
            },
   

    GetName = function ( self )
        return self.name
    end,
    SetName = function(self,name)
        print(name)
        self.name = name
    end,

    GetHp = function (self)
     return self.Hp
    end,
    SetHp = function (self,Hp)
        
        self.Hp = Hp
    end,


}
0 回复
1