<commit_before>package gomud

type FightStatus string

const (
	StartedFightStatus FightStatus = "started"
	EndedFightStatus   FightStatus = "ended"
)

type Fight struct {
	Attacker *Mob
	Defender *Mob
	Status   FightStatus
}

func NewFight(attacker *Mob, defender *Mob) *Fight {
	attacker.disposition = fightingDisposition
	defender.disposition = fightingDisposition
	f := &Fight{
		Attacker: attacker,
		Defender: defender,
		Status:   StartedFightStatus,
	}
	return f
}

func (f *Fight) IncludesMob(mob *Mob) bool {
	return f.Attacker == mob || f.Defender == mob
}

func (f *Fight) End() {
	f.Status = EndedFightStatus
}

func (f *Fight) Proceed() {
	f.turn(f.Attacker)
	f.turn(f.Defender)
	if f.Attacker.hp < 0 || f.Defender.hp < 0 {
		f.End()
	}
}

func (f *Fight) IsEnded() bool {
	return f.Status == EndedFightStatus
}

func (f *Fight) turn(m *Mob) {
	if m == f.Attacker {
		m.attack(f.Defender)
	} else if m == f.Defender {
		m.attack(f.Attacker)
	}
}<commit_msg>refactor<commit_after>package gomud

type FightStatus string

const (
	StartedFightStatus FightStatus = "started"
	EndedFightStatus   FightStatus = "ended"
)

type Fight struct {
	Attacker *Mob
	Defender *Mob
	Status   FightStatus
}

func NewFight(attacker *Mob, defender *Mob) *Fight {
	attacker.disposition = fightingDisposition
	defender.disposition = fightingDisposition
	return &Fight{
		Attacker: attacker,
		Defender: defender,
		Status:   StartedFightStatus,
	}
}

func (f *Fight) IncludesMob(mob *Mob) bool {
	return f.Attacker == mob || f.Defender == mob
}

func (f *Fight) End() {
	f.Status = EndedFightStatus
}

func (f *Fight) Proceed() {
	f.turn(f.Attacker)
	f.turn(f.Defender)
	if f.Attacker.hp < 0 || f.Defender.hp < 0 {
		f.End()
	}
}

func (f *Fight) IsEnded() bool {
	return f.Status == EndedFightStatus
}

func (f *Fight) turn(m *Mob) {
	if m == f.Attacker {
		m.attack(f.Defender)
	} else if m == f.Defender {
		m.attack(f.Attacker)
	}
}
{'fraction_non_alphanumeric': 0.13063763608087092, 'fraction_numerical': 0.002073613271124935, 'mean_word_length': 3.9360613810741687, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5403825', 'n_tokens_mistral': 807, 'n_tokens_neox': 781, 'n_words': 182}