package gameplay.actions; import gameplay.frames.Frame; /** * This class represent one section (generally one isolated hit) of an attack. */ public class attackPart { private int damage, chipDamage, hitstun, blockstun; private double knockbackOnHit, knockbackOnBlock; private Frame[] frames; private boolean hasHit; /** * Constructor with most parameters for an attack part, generally a hit * @param damage the damage dealt to the enemy if the attack part connects * @param chipDamage the damage dealt to the enemy if the attack part is blocked * @param hitstun the amount of frames where the enemy is in hitstun if the attack part connects * @param blockstun the amount of frames where the enemy is in blockstun if the attack part is blocked * @param knockbackOnHit the distance the enemy gets moved back if hit * @param knockbackOnBlock the distance the enemy gets moved back if blocked * @param frames the array of frames for the part */ public attackPart(int damage, int chipDamage, int hitstun, int blockstun, double knockbackOnHit, double knockbackOnBlock, Frame[] frames) { this.damage = damage; this.chipDamage = chipDamage; this.hitstun = hitstun; this.blockstun = blockstun; this.knockbackOnHit = knockbackOnHit; this.knockbackOnHit = knockbackOnBlock; this.frames = frames; if(this.frames.length >= 1) {this.frames[this.frames.length-1].setLastFrameOfHit(true);} this.hasHit = false; } /** * Constructor for an attack part with only a frames array as parameter. * Generally for a move startup or recovery. * @param frames the array of frames for the part */ public attackPart(Frame[] frames) { this.frames = frames; this.damage = 0; this.chipDamage = 0; this.hitstun = 0; this.blockstun = 0; this.knockbackOnHit = 0.0; this.knockbackOnBlock = 0.0; this.hasHit = false; if(this.frames.length >= 1) {this.frames[this.frames.length -1].setLastFrameOfHit(true);} } public boolean hasHit() { return hasHit; } public void setHasHit(boolean hasHit) { this.hasHit = hasHit; } public int getDamage() { return this.damage; } public void setDamage(int damage) { this.damage = damage; } public int getChipDamage() { return this.chipDamage; } public void setChipDamage(int chipDamage) { this.chipDamage = chipDamage; } public int getHitstun() { return hitstun; } public void setHitstun(int hitstun) { this.hitstun = hitstun; } public int getBlockstun() { return blockstun; } public void setBlockstun(int blockstun) { this.blockstun = blockstun; } public double getKnockbackOnHit() { return knockbackOnHit; } public void setKnockbackOnHit(double knockback) { this.knockbackOnHit = knockback; } public Frame[] getFrames() { return frames; } public void setFrames(Frame[] frames) { this.frames = frames; } public double getKnockbackOnBlock() { return knockbackOnBlock; } public void setKnockbackOnBlock(double knockbackOnBlock) { this.knockbackOnBlock = knockbackOnBlock; } public void clone(attackPart aP) { this.hasHit = aP.hasHit(); this.blockstun = aP.getBlockstun(); this.hitstun = aP.getHitstun(); this.chipDamage = aP.getChipDamage(); this.frames = aP.getFrames(); this.knockbackOnHit = aP.getKnockbackOnHit(); this.knockbackOnBlock = aP.getKnockbackOnBlock(); this.damage = aP.getDamage(); } }