자유게시판

#==============================================================================
# ● RPG::Armor
#==============================================================================

class Armor
  #--------------------------------------------------------------------------
  # ● MaxHP 변화량을 메모로부터 취득한다. ex) maxhp(n)
  #--------------------------------------------------------------------------
  def maxhp
    text = @note[/maxhp(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● MaxTP 변화량을 메모로부터 취득한다. ex) maxmp(n)
  #--------------------------------------------------------------------------
  def maxmp
    text = @note[/maxmp(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● PDP 추가치를 메모로부터 취득한다. ex) pdp(n)
  #--------------------------------------------------------------------------
  def pdp
    text = @note[/pdp(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● MDP 추가치를 메모로부터 취득한다. ex) mdp(n)
  #--------------------------------------------------------------------------
  def mdp
    text = @note[/mdp(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● WP 추가치를 메모로부터 취득한다. ex) wp(n)
  #--------------------------------------------------------------------------
  def wp
    text = @note[/wp(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● PEV 추가치를 메모로부터 취득한다. ex) pev(n)
  #--------------------------------------------------------------------------
  def pev
    text = @note[/pev(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
  #--------------------------------------------------------------------------
  # ● MEV 추가치를 메모로부터 취득한다. ex) mev(n)
  #--------------------------------------------------------------------------
  def mev
    text = @note[/mev(-*d+)/]
    return 0 if text == nil
    result = text[/d+/].to_i
    return (text.include?("-") ? -result : result)
  end
end

 

이렇게 하면 뭐가 되냐면

방어구(class Armor)의 메모(@note)를 검색해서 가령 mev(3)이란 문자열이 있을 때

mev는 검색판별로 사용하고 실질값 3을 구해서 armor.mev등으로 추가하는거죠.

즉 그경우 armor(game_actor에선 armor_id를 @item으로 넣어버리므로 @item.mev).mev는 3이 됩니다.


List of Articles
분류 제목 글쓴이 날짜 조회 수
공지 아방스 게시물 · 댓글 작성 규칙 (최근 수정일 2015.11.25) 17 file 완폐남™ 2012.07.17 47389
잡담 컴퓨터 , 인터넷 복귀 자축. zero_som 2009.10.04 1223
잡담 컴퓨터 [ 나도... 잇는다. ] 4 Tassy 2010.05.27 376
잡담 컴퓨터 갈아엎기 9 코르뉴 2010.04.15 442
잡담 컴퓨터 고장났습니다... 10 돌치나 2014.02.02 286
잡담 컴퓨터 고쳤습니다...@_@; 6 허걱 2011.03.15 580
잡담 컴퓨터 때문에 ㅠㅠㅠ 작업한게 ㅜㅜㅠㅜ 날아갔어요 ㅠㅠㅠ 15 file 말뚝이 2013.06.16 814
잡담 컴퓨터 바꿉니다. 10 JACKY 2011.01.22 274
잡담 컴퓨터 바꿨습니다 ㅠㅠ 감격감격 20 JACKY 2011.01.24 369
잡담 컴퓨터 사양같은거 제대로 못보시는 분이 있는거 같아서.. 1 코르뉴 2009.12.13 997
잡담 컴퓨터가 고장났습니다. 16 zero_som 2010.02.22 390
잡담 컴퓨터가 맛이 갔다가 안 갔다가 하네요. 일단 2015.02.01 67
잡담 컴퓨터가 미쳤어요. 14 코르뉴 2010.04.20 385
잡담 컴퓨터가 왜이래 ㅠ 3 Lathrion 2011.03.29 744
잡담 컴퓨터가 죽은 것 같습니다. 1 Alkaid 2022.10.17 72
잡담 컴퓨터가 타버렸습니다... KYUN0202 2020.08.06 105
잡담 컴퓨터게임 그래픽디자이너 11 알중: 2010.03.04 581
잡담 컴퓨터도 GG를 치네. 3 강현문 2010.03.13 308
잡담 컴퓨터돌아왔다!!!!!!!!!!!!!!!!!!!!! 6 JACKY 2011.07.18 618
잡담 컴퓨터를 바꾸고나서 유일하게 후회하는것. 6 JACKY 2011.05.14 706
잡담 컴퓨터를 바꿨습니다 12 휘파람개비 2011.01.13 287
목록
Board Pagination Prev 1 ... 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 ... 457 Next
/ 457