use of com.lilithsthrone.game.inventory.clothing.DisplacementType in project liliths-throne-public by Innoxia.
the class CharacterInventory method getNextClothingToRemoveForCoverableAreaAccess.
public SimpleEntry<AbstractClothing, DisplacementType> getNextClothingToRemoveForCoverableAreaAccess(CoverableArea coverableArea) {
// TODO
AbstractClothing clothingToRemove = null;
DisplacementType displacement = null;
List<AbstractClothing> zLayerSortedList = new ArrayList<>(clothingCurrentlyEquipped);
zLayerSortedList.sort(new ClothingZLayerComparator().reversed());
outerloop: for (AbstractClothing clothing : zLayerSortedList) {
for (BlockedParts bp : clothing.getClothingType().getBlockedPartsList()) if (bp.blockedBodyParts.contains(coverableArea) && !clothing.getDisplacedList().contains(bp.displacementType)) {
if (!isCoverableAreaExposedFromElsewhere(clothing, coverableArea)) {
// this clothing is blocking the part we want access to, so make that our starting point:
clothingToRemove = clothing;
displacement = bp.displacementType;
break outerloop;
}
}
}
if (clothingToRemove == null) {
throw new IllegalArgumentException("There is no clothing covering this part!");
}
boolean finished = false;
while (!finished) {
finished = true;
outerloop2: for (BlockedParts bp : clothingToRemove.getClothingType().getBlockedPartsList()) {
if (bp.displacementType == displacement) {
for (ClothingAccess ca : bp.clothingAccessRequired) {
for (AbstractClothing clothing : zLayerSortedList) {
if (clothing != clothingToRemove) {
for (BlockedParts bpIterated : clothing.getClothingType().getBlockedPartsList()) {
if (bpIterated.clothingAccessBlocked.contains(ca) && !clothing.getDisplacedList().contains(bpIterated.displacementType)) {
if (!isCoverableAreaExposedFromElsewhere(clothing, coverableArea)) {
// this clothing is blocking the clothing we wanted to displace, so now we re-start by wanting to displace this new clothing:
clothingToRemove = clothing;
displacement = bpIterated.displacementType;
finished = false;
break outerloop2;
}
}
}
}
}
}
}
}
}
return new SimpleEntry<AbstractClothing, DisplacementType>(clothingToRemove, displacement);
}
Aggregations