- Create class MountModel
- id
- name
- profile_id
- mount_save
- army_list_id
- MountModel.MountSave > 0, for mount (riding animal) => IsMounted == true => providing mount_save and double cost
- MountModel.MountSave == 0, for monster => IsMounted == false => providing mount_save and double cost
- MountModel.toSingleModel() => creates SingleModel with MountSave = 0
- Update
MainModel.AddMount()
public void AddMount(MountModel mountModel)
{
SingleModels[0].MountSave = mountModel.MountSave;
SingleModel singleModel = mountModel.toSingleModel();
AddSingleModel(singleModel);
}
- Update ORM:
public List<MountModel> Mounts(int armyListId)
- Delete SingleModel.Mountable
- Delete SingleModel.Mount
- Delete MainModels which are only mounts, like Runenamboß and Runenthron, maybe more
- Create table mount
- Insert all single models with mountable = 1 AND mount = 0; => 246
- Insert all single models with mountable = 1 AND mount = 1; => 3
- Delete single_model.mount
- Delete single_model.mountable
SELECT mount, count(mount) FROM single_model GROUP BY mount;
mount|count(mount)
0|949
1|61
-
single_model.moutable = SingleModels to display in SelectMountView
-
SingleModel.Mount = riding animals added via SelectMountView using MainModel.AddMount() => provide mount_save and double cost
SELECT count(*) FROM single_model WHERE mountable = 1 AND mount = 0;
246 selectable from SelectMountView, NOT providing mount_save and no double cost
=> Monsters to be assigned to character models
SELECT count(*) FROM single_model WHERE mountable = 0 AND mount = 1;
58 NOT selectable from SelectMountView, providing mount_save and no double cost
=> Riding animals already assigned to characters or troopers
=> mount save = 0, because mount_save is already set on rider
SELECT count(*) FROM single_model WHERE mountable = 1 AND mount = 1;
3 Mounts selectable from SelectMountView, providing mount_save and double cost
=> riding animals selectable from SelectMountView to be assigned to character models
=> Insert into mount table, mount_save > 0
SELECT id, name FROM single_model WHERE mountable = 1 AND mount = 1;
46708|Elfenroß
46715|Kampfechse
47376|Wildschwein
SELECT id, name, mount_save FROM single_model WHERE main_model_id IN (SELECT main_model_id FROM single_model WHERE id IN (SELECT id FROM single_model WHERE mountable = 0 AND mount = 1));
SELECT id, name, mount_save FROM single_model WHERE mount_save > 0 AND main_model_id IN (SELECT main_model_id FROM single_model WHERE id IN (SELECT id FROM single_model WHERE mountable = 0 AND mount = 1));
SELECT count(*) FROM single_model WHERE main_model_id IN (SELECT main_model_id FROM single_model WHERE id IN (SELECT id FROM single_model WHERE mountable = 0 AND mount = 1));
=> 132
-- SingleModels mounted on riding animals
SELECT id, name, mount_save FROM single_model WHERE mount_save > 0 AND main_model_id IN (SELECT main_model_id FROM single_model WHERE id IN (SELECT id FROM single_model WHERE mountable = 0 AND mount = 1));
id|name|mount_save
46760|Wildork|2
46761|Ork|2
46762|Goblin|1
46763|Waldgoblin|1
46809|Silberhelm|1
46810|Drachenprinz|1
46896|Schwarzer Reiter|1
-- Current sql in ArmyListRepositorySqlite.Mounts
var sql = @"
SELECT
sm.Id, sm.Name, sm.profile_id as ProfileId, sm.mount, sm.mountable, sm.count, sm.mount_save As MountSave,
p.Id, p.Movement, p.weapon_skill as WeaponSkill, p.ballistic_skill as BallisticSkill, p.Strength, p.Toughness, p.Wounds, p.Initiative, p.Attacks, p.Moral, p.Points, p.Save
FROM
single_model sm
INNER JOIN
main_model mm ON sm.main_model_id = mm.id
INNER JOIN
profile p ON sm.profile_id = p.id
WHERE
sm.mountable = 1 AND mm.army_list_id = @ArmyListId";