Examples of Kun


Examples of cz.beranek.model.herniPlan.Kun

    Hrac hrac = hra.getHrac(userId);
    int res = hra.kupDostihy(hrac, 1);
    //FIXME: kupDostihy. Spring ResourceBundle na text zprav...
    switch (res){
    case 0:
      Kun k = (Kun)HerniPlan.getPole(hrac.getPozice());
      int pd = hra.getObsazeniDostihu().getDostihy(k);
      Zpravy.odesliPocetDostihu(hra, hrac, pd, hrac.getPozice());
      // Zpravy.odesliVsemZpravu(this, k + " je nyn� obsazen " + newKd + " dostihy.");
      break;
    case 10:
View Full Code Here

Examples of cz.beranek.model.herniPlan.Kun

   * @return
   */
  public int kupDostihy(Hrac hrac, int pocet){
    IPole p = HerniPlan.getPole(hrac.getPozice());
    if (p instanceof Kun){
      Kun k = (Kun) p;

      //Kontrola vlastnictvi staje
      boolean vlastniStaj = true;
      for (Kun kun : k.getStaj()) {
        vlastniStaj &= getSeznamMajetku().getMajitel(kun) == hrac;
      }
      if(!vlastniStaj){
        return 10;
      }
     
      //Kontrola nakupu ihned po zakoupeni kone
      if(koupenyKun){
        return 30;
      }
     
      //Kontrola poctu dostihu
      //5 je max
      int kd = getObsazeniDostihu().getDostihy(k);
      if (kd == 5){
        return 20;
      }
      //Prek koupenim HD musi byt koupeny 4
      int newKd = kd + pocet;
      if(kd < 4 && newKd == 5){
        return 21;
      }
      //Krajni meze, nemelo by se stat
      if(pocet < 0 || newKd > 5){
        return 22;
      }
      //Pri nesouvislem nakupu vice dostihu
      if(koupenyDostihy && newKd == 5){
        return 23;
      }
     
      //Platba
      boolean zaplaceno = hrac.zaplat(null, pocet * k.getCenaDostihu());
      if (!zaplaceno){
        //nedostatek penez
        return 100;
      }
     
View Full Code Here

Examples of cz.beranek.model.herniPlan.Kun

      return 1; // Majitelem je banka
    if (majitel == komu)
      return 2; // Nelze prodad sam sobe
   
    if(artikl instanceof Kun){
      Kun k = (Kun) artikl;
      int pd = 0;
      for (Kun kun : k.getStaj()) {
        pd += getObsazeniDostihu().getDostihy(kun);
      }
      if(pd > 0) return 3; //Nelze prodat cast staje s obsazenym dostihem.
    }
    if(komu == null){
View Full Code Here

Examples of cz.beranek.model.herniPlan.Kun

      if (majitel == komu)
        return 23; // Nelze prodad sam sobe
     
      //Kontrola prodeje casti staje
      if(artikl instanceof Kun){
        final Kun k = (Kun) artikl;
        final Set<Kun> staj = k.getStaj();
        int pd = 0;
        for (Kun kun : staj) {
          pd += getObsazeniDostihu().getDostihy(kun);
        }
        if(pd > 0 && !copy.containsAll(staj)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.