Jump to content

Featured Replies

Posted
comment_13281

I've used Ruse a lot and never seen anything even similar to this.

OT:

				int recDamage = (int) (damage * 0.001);
				if (recDamage <= 0)
					return;
				if (recDamage > t2.getConstitution())
					recDamage = t2.getConstitution();
				attacker.dealDamage(new Hit(recDamage, Hitmask.RED, CombatIcon.DEFLECT));

From the recoil effect lol. It has nothing to do with barrows degrading. You're making your Dharok's return damage to the attacker..


You also have so much repetetive code. You could do it as simple as this:

DegradingItem:

		public static Optional<DegradingItem> forItem(int item) {
			for(DegradingItem d : DegradingItem.values()) {
				if(d.deg == item || d.nonDeg == item) {
					return Optional.of(d);
				}
			}
			return Optional.empty();
		}

CombatFactory:

				//Handle equipped items for our target..
				for(Item item : t2.getEquipment().getItems()) {
					
					//Check if the target's item should degrade..
					Optional<DegradingItem> deg = DegradingItem.forItem(item.getId());
					if(deg.isPresent()) {
						ItemDegrading.handleItemDegrading(t2, deg.get());
					}
					
					switch(item.getId()) { //Handle other items..
					case 2550: //Handle recoil effect..

						break;
					}
				}

Wrote this quickly.

  • 2 years later...
  • 2 years later...
  • 3 weeks later...
  • 3 months later...

Create an account or sign in to comment