關於我

ID: 07140524
暱稱: 水蛭
所在地: 水蛭他家
網站: https://www.youtube.com/watch?v=YrpNTUnlO14
阏 : 321 days ago
for i,event in ipairs(game.events) do
  if event.type == "talk" then
    if not event.playerInfo.isEnemy and event.text == "敵人在我這" then
      me.moveTo(event.playerInfo)
    end
  end
end

ice = game.findClosest(me, game.findDevices("可推石塊"))
if ice then
  pushLocs = ice:findPushMoveLocs("down")
  if #pushLocs > 0 then
    pushLoc = pushLocs[1]
    if me.loc == pushLoc then
      me.triggerKeyboardDown("s")
    else
      me.moveTo(pushLoc)
    end
  end
end

if  me.currentWeaponInfo.type=="手槍" then
weapon=  me.findClosestItem("步槍","霰彈槍","狙擊槍")
me.moveTo(weapon)
end

if me.currentWeaponInfo.type=="手槍" then
 me.triggerKeyboard("space")
 
 weapon=nil
else
 me.moveTo(weapon)
end

if me.caisson.bullets == 0 then
  
  magazine = me.findClosestItem("彈匣")

  if magazine then
  
    game.logState("目標", "拿彈匣")

    if me.loc == magazine.loc then
  
      me.triggerKeyboard("space")
   
    else

      me.moveTo(magazine)
  
      return
  
    end

  end

end


enemy = me.findClosestEnemy()
if enemy then

  game.logState("目標", "攻擊敵人:"..enemy.info.name)
  
  me.setAimTarget(enemy)
  
  
  if me.currentWeaponInfo.isCloseWeapon then
    
    if enemy.loc:distanceTo(me.loc) > 7 and me.nextWeaponInfo.isRangedWeapon then
    
      me.triggerKeyboard("q")
    end

  else
   
    if enemy.loc:distanceTo(me.loc) <= 1 and me.nextWeaponInfo.isCloseWeapon then
      
      me.triggerKeyboard("q")
    end
  end
  

  if me.currentWeaponHasClearLineTo(enemy) then
    
    me.turnTo(enemy)
    me.triggerMouse()
    me.moveTo(game.map.getRandomLocFrom(me, me, 1))
  end
 
  return
end


friend = me.findClosestFriend()

if friend then
 
  game.logState("目標", "尋找敵人:"..friend.info.name)
  
    if friend.loc:distanceTo(me.loc) > 3 then
      
       me.moveTo(friend)
       end

else
 
  game.logState("目標", "漫無目標")
  
  if me.movingToLoc == nil and math.random() < 0.1 then
    
    me.moveTo(game.map.getRandomLocFrom(me, me, 6))
  end  
end

if me.currentWeaponInfo.type=="手槍" then
weapon= me.findClosestItem("霰彈槍","狙擊槍")
me.moveTo(weapon)
end

if me.currentWeaponInfo.type=="手槍" then
 me.triggerKeyboard("space")
 
 weapon=nil
else
 me.moveTo(weapon)
end

if me.currentWeaponInfo.type=="小刀" then
weapon= me.findClosestItem("大刀","爪")
me.moveTo(weapon)
end

if me.currentWeaponInfo.type=="小刀" then
 me.triggerKeyboard("space")
 
 weapon=nil
else
 me.moveTo(weapon)
end


if brain == nil then
brain = {}
brain.nextWalkTime = game.now - 1
brain.nextSwapTime = game.now - 1
me.triggerKeyboard("h")
end

if me.isSpirit then
return dofile("spirit.lua")
end


if #game.events > 0 then
for i, event in ipairs(game.events) do
game.log(tostring(event), true)
if event.type == "beingAttacked" then
     me.talk("痛啊~")
     me.turnTo(event.angle)
     me.triggerMouse()
   end
end
end



if game.now > brain.nextWalkTime then


local followTarget = me.getAimTarget()
local keepDistance = 0
if followTarget then

    if me.currentWeaponHasClearLineTo(followTarget) then
      me.triggerMouse()
    end
else

followTarget = me.findClosestEnemy()
if followTarget then

me.setAimTarget(followTarget.info.id)
end
end


if followTarget == nil then
   

    if me.currentWeaponInfo.type == "小刀" or me.currentWeaponInfo.type == "手槍" then
      local closestWeapon = game.findClosest(me, game.findGroundItems("大刀","狙擊槍"))
      if closestWeapon then
        if closestWeapon.loc == me.loc then
         

          me.triggerKeyboard("space")
        else
         
          followTarget = closestWeapon
        end
      end
    end
    
    if followTarget == nil then
      
      followTarget = me.findClosestFriend()
      keepDistance = 3
    end
  end
if followTarget then
if followTarget.loc:distanceTo(me.loc) > keepDistance then
me.moveTo(followTarget.loc.x, followTarget.loc.y)
end
  end
brain.nextWalkTime = game.now + 300
end

if brain.nextSwapTime < game.now then
if me.currentWeaponInfo.type == "小刀" then
me.talk("小刀不用換")
else
me.triggerKeyboard("q")
me.talk("換武器!")
end
brain.nextSwapTime = game.now + 5000
end

if me.mp>=100 and me.hp <= 75 and me.action == "idle" and me.currentWeaponInfo.type ~="小刀" then
  me.triggerKeyboard("q")
end

if me.mp>=100 and me.hp <= 75 and me.action == "idle" and me.currentWeaponInfo.type =="小刀" then
  me.triggerMouseDown("q")
end

if me.mp==0 and me.action == "charge" then
  me.triggerMouseUp("q")
end

if me:getAimTarget() == nil then
  if me.currentWeaponInfo.isCloseWeapon then
    if me.nextWeaponInfo.isRangedWeapon then
      me.triggerKeyboard("q")
    end
  elseif me.magazine.available < me.magazine.size then
    me.triggerKeyboard("r")
  end
end

if me.hp < me.hpMax then
  me.talk("阿不然你打我R")
else
  me.talk("WTF!")
end
悄悄話 : 503 days ago
(悄悄話)
悄悄話 : 1035 days ago
(悄悄話)
水蛭 水蛭: 1035 days ago
(悄悄話)

朋友