Skip to content
Lien Chiang edited this page Aug 7, 2014 · 2 revisions

attack process

# 0x0042E100
def attack_process(attacker_id)
  if itr_id <= itrs_size
    if injured->vrest_of_objects[attacker_id] <= 0

      # injured is a weapon, attack, criminal or drink
      if attacker->? == 0 or not file->type == character_type
      end

      # injured is caught, but is not hurtable
      if cpoint_kind == 2 and cpoint_catcher_id == injured_id and not hurtable == 0
      else

        # injured is burning
        if kind == 0 and itr->effect == 21 and (state == fire_state or state == burn_run_state)

       

        end

        # attacker is a weapon being held
        if (itr->kind == 5 and
            attacker->weapon_type < 0 and
            holder->weapon == attacker_id)

          # attack is valid
          if attaking > 0 and not @holder_id == injured_id

        

          end
        end

        # attacker is a man being thrown away
        if attacker->thrown_injury > 0 and itr->kind == 4

          # adjust the direction
          if (attacker->x_velocity > 0 and
              attacker->facing == facing_left)

        

          end

          # adjust the direction
          if (attacker->x_velocity < 0 and
              attacker->facing == facing_right)

        

          end
        end

        # injured is holding a heavy weapon
        if (injured->weapon_type == heavy_weapon_type and
            itr->kind == 0 and
            weapon->holder == injured and
            weapon->weapon_type == - heavy_weapon_type)

       

        end

        # injured is a heavy weapon
        if file->type == heavy_weapon_type

       

        end

        # attacker is a john's force field
        if (itr->kind == 9 and
            (file->type == character_type or
             file->frames[frame_id].state == throwing_state or
             file->frames[frame_id].state == in_the_sky_state_2))
          # injured is a character
          if file->type == character_type

        

          end
        end

        # normal attack
        if itr->kind == 0

          # injured is knight, louis or julian
          if (not bdefend == 100 and
              not state == broken_defend_state and
              not state == injured_state_1 and
              not state == falling_state and
              not state == ice_state and
              not state == lying_state and
              not state == injured_state_2 and
              not state == fire_state)

            # injured is knight
            if (injured_file_id == knight_dat and
                injured->bdefend <= 15 and
                not effect_type == 2 and
                not effect_type == 3 and
                not effect == 2 and
                not effect == 3 and
                not attacker_file_id == john_biscuit_dat and
                not attacker_file_id == henry_arrow2_dat)

         

            end

            # injured is louis
            if (injured_file_id == louis_dat and
                injured->bdefend < 1 and
                not effect_type == 2 and
                not effect_type == 3 and
                not effect == 2 and
                not effect == 3 and
                not attacker_file_id == john_biscuit_dat and
                not attacker_file_id == henry_arrow2_dat and
                injured->frame_id < 20 and
                file->frames[frame_id].state == dash_state and
                file->frames[frame_id].state == jump_state and
                file->frames[frame_id].state == defend_state)

         

            end

            # injured is julian
            if (@injured_file_id == julian_dat and
                injured->bdefend <= 15 and
                not attacker_file_id == john_biscuit_dat and
                not attacker_file_id == henry_arrow2_dat)

         

            end
          end

          # can't break injured's defense
          if (injured_frame->state == defend_state and
              bdefend <= 60 and
              (
                not attacker_facing == injured->facing or
                not itr->dvx >= 0 or
                attacker_file_id == <_dat or
                attacker_file_id == jan_chase_dat or
                attacker_file_id == firzen_chasef_dat or
                attacker_file_id == firzen_chasei_dat
              ) and
              injured->hp > 0)

        

          end

          if not file->id == criminal_dat
            if not type == drink_type

              # injured wears the armor
              if armor > 0

          

              end

              # attacter's kills + 1
              if (hp > 0 and
                  injury >= hp and
                  @injured_type == character_type)
                if (injured->clone == not_clone and
                    _? > 0 and
                    _? < 3)
                end
              end

              # attacker's total attack is increasing
              if (file->type == character_type and
                  injured->clone == not_clone)
              end

              if _? > 0 and _? < 3
              end
            end

            if (injured->hp <= 0 or
                itr->effect == 4)
            end

            # weapons and drinks are destroyed by bdefend 100
            if (type == lignt_weapon_type or
                type == heavy_weapon_type or
                type == throw_weapon_type or
                type == drink_type)
              if itr->bdefend == 100
              end
            end

            if (not file->type == heavy_weapon_type or
                itr->fall > 40)
            end

            # set weapons' and some states' fall to 80
            if (file->frames[frame_id].state == ice_state or
                file->frames[frame_id].state == falling_state or
                type == lignt_weapon_type or
                type == throw_weapon_type or
                type == drink_type or
                type == heavy_weapon_type)
            end

            # adjust injured's fall and set injured's frame
            if (fall > 60 and
                not file-type == attack_type)
            elsif (fall > 40 and
                   not file->type == attack_type)
              # injured is in the sky, so set its fall to 80
              if injured->y < 0
              end
            elsif (fall > 20 and
                   not file->type == attack_type)
              # injured is in the sky, so set its fall to 80
              if injured->y < 0
              end
            elsif (fall > 0 and
                   not file->type == attack_type)
              # injured is in the sky, so set its frame to injured frame
              if injured->y < 0
                injured->frame_id = (facing == attacker->facing ?
                                 back_injured_frame :
                                 front_injured_frame)

           or

              end
            end

more information at https://github.com/xsoameix/lf2/blob/master/attack_process.rb

Clone this wiki locally