001package net.tnemc.item.component.helper; 002/* 003 * The New Item Library 004 * Copyright (C) 2022 - 2025 Daniel "creatorfromhell" Vidmar 005 * 006 * This program is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 021import java.util.ArrayList; 022 023/** 024 * DamageReduction - Controls how much damage should be blocked in a given attack 025 * 026 * @author creatorfromhell 027 * @since 0.2.0.0 028 */ 029public class DamageReduction { 030 031 protected final String type; 032 protected final float base; 033 protected final float factor; 034 protected final float horizontalBlockingAngle; 035 036 public DamageReduction(final String type, final float base, final float factor) { 037 038 this(type, base, factor, 90.0f); 039 } 040 041 public DamageReduction(final String type, final float base, final float factor, final float horizontalBlockingAngle) { 042 043 this.type = type; 044 this.base = base; 045 this.factor = factor; 046 this.horizontalBlockingAngle = horizontalBlockingAngle; 047 } 048 049 public String type() { 050 051 return type; 052 } 053 054 public float base() { 055 056 return base; 057 } 058 059 public float factor() { 060 061 return factor; 062 } 063 064 public float horizontalBlockingAngle() { 065 066 return horizontalBlockingAngle; 067 } 068 069 @Override 070 public DamageReduction clone() throws CloneNotSupportedException { 071 072 return new DamageReduction( 073 this.type, 074 this.base, 075 this.factor, 076 this.horizontalBlockingAngle 077 ); 078 } 079}