Vanilla Angband editing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • redrobert
    Scout
    • Sep 2011
    • 29

    #16
    thank you!

    but i will probably reduce de source. i think i do not need the b-thingy

    Comment

    • Derakon
      Prophet
      • Dec 2009
      • 9022

      #17
      In any event, please use more than one letter for your variable names.

      (Time spent typing is, like, 5% of the time you spend on a given programming project. Then maybe 25% is figuring out what you want to do, and the remaining 70% is reading over your code and figuring out why it's broken. It pays to have code with meaningful variable names!)

      Comment

      • redrobert
        Scout
        • Sep 2011
        • 29

        #18
        you are abolutly right Derakon

        Comment

        • redrobert
          Scout
          • Sep 2011
          • 29

          #19
          would you think 4 attacks per round with darts damage 1d3 (maybe 1d2) is overpowerd as throwing weapon that available early?

          Comment

          • redrobert
            Scout
            • Sep 2011
            • 29

            #20
            another question about editing vanilla angband.

            defines.h

            #define EGO_TVALS_MAX 3
            can i change this to another number without breaking anything?

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 5110

              #21
              Originally posted by redrobert
              another question about editing vanilla angband.

              defines.h

              #define EGO_TVALS_MAX 3
              can i change this to another number without breaking anything?
              Yes. This limits the number of T: lines in lib/edit/ego-item.txt, nothing else.
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • redrobert
                Scout
                • Sep 2011
                • 29

                #22
                next question coming

                is it possible without coding to forbid wielding a shield, buckler, etc. while wielding a certain object (staff or the like comes in my mind)

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #23
                  Originally posted by redrobert
                  next question coming

                  is it possible without coding to forbid wielding a shield, buckler, etc. while wielding a certain object (staff or the like comes in my mind)
                  No, you would have to add player or object flags for that and then add the code to act on them.
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

                  • redrobert
                    Scout
                    • Sep 2011
                    • 29

                    #24
                    i want to test if an item has a certain flag .. how can i do it? some ideas:

                    1)
                    if (of_has(flags, OF_THROWS2)

                    2)
                    if (o_ptr->state.flags[OF_THROWS2])

                    3)
                    if (p_ptr->state.flags[OF_THROWS2])


                    i really can't say if one of those would do what i like.

                    i think 1) has a good chance but i guess i would need:

                    bitflag flags[OF_SIZE], mask[OF_SIZE];
                    object_flags(o_ptr, flags);

                    as well ... or maybe just one or maybe more lines of code

                    to illustrate what i would like to do:
                    int breakage_chance(const object_type *o_ptr, bool hit_target) {
                    int perc = o_ptr->kind->base->break_perc;

                    if (o_ptr->artifact) return 0;
                    if (of_has(flags, OF_THROWS2) {
                    perc += 25;
                    }
                    if (of_has(flags, OF_THROWS3) {
                    perc += 35;
                    }
                    if (of_has(flags, OF_THROWS4) {
                    perc += 45;
                    }
                    if (!hit_target) return (perc * perc) / 100;
                    return perc;
                    }

                    Comment

                    • redrobert
                      Scout
                      • Sep 2011
                      • 29

                      #25
                      what about this:

                      Code:
                      int breakage_chance(const object_type *o_ptr, bool hit_target) {
                      	
                              bitflag f[OF_SIZE];
                              object_flags(o_ptr, f);
                              int perc = o_ptr->kind->base->break_perc;
                      
                      	if (o_ptr->artifact) return 0;
                      	if (of_has(f, OF_THROWS2)){
                              perc = 25;
                              }
                      	if (!hit_target) return (perc * perc) / 100;
                      	return perc;
                      }
                      Last edited by redrobert; October 2, 2011, 10:24.

                      Comment

                      • Magnate
                        Angband Devteam member
                        • May 2007
                        • 5110

                        #26
                        That looks fine. You don't actually need the bitflag any more though, as o_ptr->flags is authoritative. So you can just do if (o_ptr->flags, OF_THROWS2) ...

                        You probably want to use [ code ] [ / code ] tags for code in posts ...
                        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                        Comment

                        • redrobert
                          Scout
                          • Sep 2011
                          • 29

                          #27
                          Code:
                          if (o_ptr->flags, OF_SP) {
                                  bonus = o_ptr->pval[which_pval(o_ptr, OF_SP)];
                             		msp += bonus * levels;
                           	    }
                          somewhere in here has to be a pretty nasty thing .. as angband terminates without starting

                          Comment

                          • redrobert
                            Scout
                            • Sep 2011
                            • 29

                            #28
                            Code:
                                	if (o_ptr->flags, OF_SP) {
                                        bonus = o_ptr->pval;
                               	    msp = (bonus * levels) + msp;
                             	}
                            if i change the code to this angband is starting without problems .. now the question is, is it working? i guess i will find out once i find an object with the Flag

                            Comment

                            Working...
                            😀
                            😂
                            🥰
                            😘
                            🤢
                            😎
                            😞
                            😡
                            👍
                            👎