Hello PX team, I have spoken with some of you so you know who am I. For the rest, my name is Carlos and I am another X-Com fan who wants to join the project as a programmer.
Here are two patches.
The first one is very small, it only updates Psi Skill at the end of the month and has a Yes/No dialog to confirm removing a soldier from Psi training.
It contains two diff files, one has some "hacks" to test the functionality better:
PsiSkillUpdate.diff:
- Modifies Xenocide/Source/Model/Geoscape/XCorp/XCorp.cs, to handle end of month Psi Skill update.
- Modifies Xenocide/Source/UI/Screens/SoldiersListScreen.cs for two reasons:
- Add a "In Psi Training" entry to the attribute list, I think this is a bit of a hack too, but is probably the best place to show that information at the moment.
- Add a Yes/No dialog when removing a soldier from Psi training. Note there is a ToDo in there that should be taken care when "In Psi Training" is removed from the attribute list.
- Adds an entry to Xenocide/Resources/Strings.resx, for the Yes/No dialog text.
PsiSkillUpdateWithHacks.diff:
- Same modifications as the above file.
- Modifies Xenocide/Source/Model/Geoscape/GeoEvents/MessageBoxGeoEvent.cs, so the time doesn't stop when an UFO is detected. This makes easy to reach the end of the month.
- Modifies Xenocide/Source/UI/Screens/SoldiersListScreen.cs, comments out the "Debug.Assert(false)" when populating the attributes list, this is because currently not all statistics are handled before the default clause making impossible to open the Soldiers Screen from the base and thus testing Psi Training. The other option would have been adding all missing statistics to the switch, but for testing purpose this was faster and eventually all statistics will be handled properly.
The second patch is a bit bigger, it implements finding a missed location for a shot.
- Modifies Xenocide/Source/Model/Battlescape/Combatants/Orders/ShootOrder.cs:
- Implement the proposed logic for finding a miss shot location with the exception that the radius is capped by the Manhattan distance from the shooter and the target. This code could be written in many different ways, I chose to go trough all cells from (-radius, -radius) to (+radius, +radius) and check if they are closer than radius. Another possibility could have been going trough cells that are in fact in range, this can be achieved with simple code but needs to check for repeated cells, e.g. (+0, y) and (-0, y); or have a complex and ugly code that handles cases with 0 distance for some component separately.
- Some small modifications along the file to ensure that hitting another combatant actually hurts it.
- BUG FIX: Added a check when killing a combatant so there isn't an achievement recorded when you kill someone from your own team. For XCorp only killing aliens are considered achievements. For aliens currently it only checks if victim isn't an alien, hence killing a civilian will give him an achievement. This may not be the intended behavior but is better than getting achievements for killing friends or civilians at will.
- Modifies Xenocide/Source/Model/Battlescape/Team.cs:
BUG FIX: Check if a combatant is dead before bleeding him, without this you can start a battlescape and kill some other XCorp friends and click on the finish turn. If at least one of them died he will be removed from the terrain. At the end of the turn, when bleeding, the system will try to remove him from the terrain again and the "Debug.Assert(combatant.CombatantId == cells[index].CombatantId);" will fail.
I didn't remove any of the "ToDo"s I implemented, I did this so it can be easier to compare the actual code with the reasoning behind it.
I'm looking forward hearing any suggestions, comments or corrections you may have, hope you like it.
Thanks, sorry for the post being very long,
Carlos