UltimaForum

Wsparcie [XP] - Trwała osłona

Yoroiookami - Sob 03 Kwi, 2010 13:06
Temat postu: Trwała osłona
Jak zrobić umiejętność, która gwarantowałaby osłonę/lub unik przed atakami na jakiś czas? :shock:
Nie mam pojęcia jak się do tego zabrać.

Ayene - Sob 03 Kwi, 2010 19:11

Spróbuj tego:
Spoiler:

Kod:
module Ayene   
  ID_STATUSU = [17]  # ID statusu narzucającego nietykalność
end

class Game_Battler
 
  def attack_effect(attacker)
    self.critical = false
    hit_result = (rand(100) < attacker.hit)
    if hit_result == true
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage = atk * (20 + attacker.str) / 20
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      if self.damage > 0
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage *= 2
          self.critical = true
        end
        if self.guarding?
          self.damage /= 2
        end   
        if Ayene::ID_STATUSU.any? {|i| @states.include?(i)}
          self.damage = 0
        end       
      end
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    if hit_result == true
      remove_states_shock
      self.hp -= self.damage
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    else
      self.damage = "Miss"
      self.critical = false
    end
    return true
  end
end


Utwórz umiejętność, która narzuca status nietykalność - też musisz go utworzyć i przyporządkować ID np. 17. Gdy postać podczas walki użyje umiejętności i narzuci wspomniany status, otrzyma 0 obrażeń.


Powered by phpBB modified by Przemo © 2003 phpBB Group