Page 2 of 6

Re: End round at end of combat

Posted: Fri Nov 04, 2016 3:01 am
by Duvalon
rijackson741 wrote:It sounds to me like a bug if it does not work if you kill the enemy in the first round. I assume it's triggered at the end of the round, both within combat and without. But entering combat within the 6 seconds or exiting combat by killing your enemy ends the round prematurely, so the conditions are not triggered. IMO, they should be triggered regardless of how the round is terminated.
Yes, that was my point exactly. I didn't do a great job explaining it.

If you don't mind, I'd like to take a look at the code and see if I can find a solution myself. A sort of baptism if you wish. Gotta start somewhere.

Re: End round at end of combat

Posted: Fri Nov 04, 2016 6:54 am
by Zukero
Duvalon wrote: If you don't mind, I'd like to take a look at the code and see if I can find a solution myself. A sort of baptism if you wish. Gotta start somewhere.
That's what the GPL license is all about. Don't like something? Hack it and change it. If yours is better than mine, either I take it or the users take yours.

Re: End round at end of combat

Posted: Fri Nov 04, 2016 8:10 am
by Nut
I prefer regenerating with meat to potions, because I can use it before starting combat, and it refills my health slowly but steadily. Drinking in combat needs AP, and you have a hit less.
And meat you get on your way, snake meat tastes best :D
When it is poisoned, I just wait in safe distance to monster until I feel better again and eat another meat.

And don't forget: bonemeal potion is illegal!

Re: End round at end of combat

Posted: Sat Nov 05, 2016 1:02 pm
by Usirim
Lol...
I say, if anyone has trouble with strong monsters, play AT in easier areas, level up, geht some new skills. Than come back and rock the area.
;)

Re: End round at end of combat

Posted: Sat Nov 05, 2016 8:00 pm
by Voom
Nut wrote:When it is poisoned, I just wait in safe distance to monster until I feel better again and eat another meat.
I always save before I eat meat and reload when there is food poisoning. Is that cheating? If it is, then I'm definitely paying a price for it b/c it is pretty damn annoying to save and reload.

I agree, a round should be terminated when combat is terminated. Like boxing, you know? A K.O. finishes a round and the match altogether. However, we have to consider the fact that we have a skill called Corpse Eater that performs exactly this function. If you are one that wants meat to give you 2 hp at the end of combat, maybe you should consider placing a few skill points in this skill.

There is no reason to fix combat's final round dilemma b/c it is actually helpful as far other actor conditions are concerned that will not dissipate once combat is over. Yes, you are probably met with more negative actor conditions than positive ones, but hey, that's life. Toughen up!

Simply put, Corpse Eater takes care of the sustenance dilemma.

Re: End round at end of combat

Posted: Mon Dec 05, 2016 3:59 am
by Duvalon
@Voom, saying "toughen up" or "get corpse eater" isn't much of an argument. It's not just about positive status effect like regen or sustenance, but also negative effects like poison, bleeding wound and chaos grip. And as I just found, time doesn't pass as it should (more below).

I finally got around to digging around the code and found where the problem was. ActorStatsController.applyConditionsToPlayer() (and the monsters equivalent applyConditionsToMonsters) is only called in two places:

Code: Select all

GameRoundController.java:
	public void onNewFullRound() {
		controllers.mapController.resetMapsNotRecentlyVisited();
		controllers.actorStatsController.applyConditionsToMonsters(world.model.currentMap, true);
		controllers.actorStatsController.applyConditionsToPlayer(world.model.player, true);
		gameRoundListeners.onNewFullRound();
	}
	public void onNewPlayerRound() {
		world.model.worldData.tickWorldTime();
		controllers.actorStatsController.applyConditionsToPlayer(world.model.player, false);
		controllers.actorStatsController.applySkillEffectsForNewRound(world.model.player, world.model.currentMap);
		controllers.mapController.handleMapEvents(world.model.currentMap, world.model.player.position, MapObject.MapObjectEvaluationType.afterEveryRound);
	}
It doesn't get called in the CombatController's

Code: Select all

	public void exitCombat(boolean pickupLootBags) {
		setCombatSelection(null, null);
		world.model.uiSelections.isInCombat = false;
		combatTurnListeners.onCombatEnded();
		world.model.uiSelections.selectedPosition = null;
		world.model.uiSelections.selectedMonster = null;
		controllers.gameRoundController.resetRoundTimers();
		if (pickupLootBags && totalExpThisFight > 0) {
			controllers.itemController.lootMonsterBags(killedMonsterBags, totalExpThisFight);
		} else {
			controllers.gameRoundController.resume();
		}
		resetCombatState();
	}
Also, notice how exitCombat() calls the gameRoundController.resetRoundTimers(). This reset has two effects: as mentioned in my original post, if you go from monster to monster quickly and kill them in the first round of combat, the status effects never apply because the 6s round gets reset before an end of round is processed. The other effect that I had noticed but wasn't sure is that time passes more slowly when fighting quickly and monsters don't respawn as fast as if you're just standing still in a corner.

Finally, I traced this change to version 0.7.0 and a commit from Oskar. Based on the comment of this commit, it seems the effect of combat on rounds was perhaps unnoticed and quite possibly unwanted.

So, in light of all this, I propose the following: remove the resetRoundTimers() call from exitFromCombat(). This will just continue the time wherever the round timer is at. Moreover, I think we should replace it with a call to a new function. Here I'm putting what I think should go in it. If you thing something doesn't belong or something else should, please let me know.

Code: Select all

	public void onNewEndOfCombatRound() {
		world.model.worldData.tickWorldTime();
		controllers.actorStatsController.applyConditionsToPlayer(world.model.player, false);
		controllers.actorStatsController.applyConditionsToMonsters(world.model.currentMap, true);
	}
I'm new to both Git and Android development so bear with me while I learn the ropes. I might be a little slow, but I will test it as soon as I learn how to build and install on my phone, and then send a pull request to Zukero.

Re: End round at end of combat

Posted: Mon Dec 05, 2016 12:25 pm
by Zukero
Good analysis, but, at a first glance, I'd look into simply changing CombatController.

Try to replace this:

Code: Select all

	private void newPlayerTurn(boolean isFirstRound) {
		if (canExitCombat()) {
			exitCombat(true);
			return;
		}
		controllers.actorStatsController.setActorMaxAP(world.model.player);
		if (!isFirstRound) controllers.gameRoundController.onNewPlayerRound();
		world.model.uiSelections.isPlayersCombatTurn = true;
		combatTurnListeners.onNewPlayerTurn();
	}
by this:

Code: Select all

	private void newPlayerTurn(boolean isFirstRound) {
		controllers.actorStatsController.setActorMaxAP(world.model.player);
		if (!isFirstRound) controllers.gameRoundController.onNewPlayerRound();
		world.model.uiSelections.isPlayersCombatTurn = true;
		combatTurnListeners.onNewPlayerTurn();
		if (canExitCombat()) {
			exitCombat(true);
			return;
		}
	}
Gotta check the side effects though.

Re: End round at end of combat

Posted: Wed Dec 21, 2016 5:41 am
by Voom
So this was unintentional, a mistake? Then why does Corpse Eater apply but not something like Regen w/o fixing the error? Honestly thought this was completely intentional. It helped me prolong my sustenance b/w combat w/in 6 seconds, sometimes to my detriment actually.

@Duvalon If it affects both positive and negative status effects (which I mentioned), then I don't see a counterargument. What would be the purpose of Corpse Eater when Regen can do the same at the end of combat? Please, explain if I'm missing something.

Re: End round at end of combat

Posted: Wed Dec 21, 2016 12:54 pm
by rijackson741
If you are being mobbed then corpse eater will give you HP on every kill, even though combat has not ended.

Re: End round at end of combat

Posted: Wed Dec 21, 2016 1:19 pm
by Zukero
And you can combine both !
I love Corpse Eater, especially when you can swat two or three flies in the same round :twisted: