Move damageMultiplier to BulletType (#7436)
* Move bullet damage multiplier to bulletType
* Is this better?
I don't know much about optimization, is this any better than before?
* Revert "Is this better?"
This reverts commit b83723701f.
This commit is contained in:
@@ -364,6 +364,13 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float damageMultiplier(Bullet b){
|
||||||
|
if(b.owner instanceof Unit u) return u.damageMultiplier() * state.rules.unitDamage(b.team);
|
||||||
|
if(b.owner instanceof Building) return state.rules.blockDamage(b.team);
|
||||||
|
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
public void hit(Bullet b){
|
public void hit(Bullet b){
|
||||||
hit(b, b.x, b.y);
|
hit(b, b.x, b.y);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,10 +82,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float damageMultiplier(){
|
public float damageMultiplier(){
|
||||||
if(owner instanceof Unit u) return u.damageMultiplier() * state.rules.unitDamage(team);
|
return type.damageMultiplier(self());
|
||||||
if(owner instanceof Building) return state.rules.blockDamage(team);
|
|
||||||
|
|
||||||
return 1f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user